-/* NetHack 3.6 rumors.c $NHDT-Date: 1542422933 2018/11/17 02:48:53 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.30 $ */
+/* NetHack 3.6 rumors.c $NHDT-Date: 1545132266 2018/12/18 11:24:26 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.34 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
void
rumor_check()
{
- dlb *rumors;
+ dlb *rumors = 0;
winid tmpwin;
char *endp, line[BUFSZ], xbuf[BUFSZ], rumor_buf[BUFSZ];
if (true_rumor_size < 0L) { /* we couldn't open RUMORFILE */
no_rumors:
pline("rumors not accessible.");
+ if (rumors)
+ (void) dlb_fclose(rumors);
return;
}
boolean special;
boolean delphi;
{
- char line[COLNO];
- char *endp;
+ winid tmpwin;
dlb *oracles;
int oracle_idx;
- char xbuf[BUFSZ];
+ char *endp, line[COLNO], xbuf[BUFSZ];
/* early return if we couldn't open ORACLEFILE on previous attempt,
or if all the oracularities are already exhausted */
oracles = dlb_fopen(ORACLEFILE, "r");
if (oracles) {
- winid tmpwin;
if (oracle_flg == 0) { /* if this is the first outoracle() */
init_oracles(oracles);
oracle_flg = 1;
if (oracle_cnt == 0)
- return;
+ goto close_oracles;
}
/* oracle_loc[0] is the special oracle;
oracle_loc[1..oracle_cnt-1] are normal ones */
if (oracle_cnt <= 1 && !special)
- return; /*(shouldn't happen)*/
+ goto close_oracles; /*(shouldn't happen)*/
oracle_idx = special ? 0 : rnd((int) oracle_cnt - 1);
(void) dlb_fseek(oracles, (long) oracle_loc[oracle_idx], SEEK_SET);
if (!special) /* move offset of very last one into this slot */
}
display_nhwindow(tmpwin, TRUE);
destroy_nhwindow(tmpwin);
+ close_oracles:
(void) dlb_fclose(oracles);
} else {
couldnt_open_file(ORACLEFILE);