[10924] in Athena Bugs
decmips 7.6F: zctl load silent failure (fix included)
daemon@ATHENA.MIT.EDU (Calvin Clark)
Wed Sep 8 21:19:59 1993
Date: Wed, 8 Sep 93 21:19:54 -0400
From: Calvin Clark <ckclark@MIT.EDU>
To: bugs@Athena.MIT.EDU
-------
System name: w20-575-64
Type and version: KN02ca 7.6F
Display type: PMAG-DV
What were you trying to do?
zctl load .zephyr.sub.discuss
What's wrong:
There is no such file .zephyr.sub.discuss. I made a typo.
Zctl failed silently. This is happening because the
function load_subs() in zctl.c does not handle fopen() failure
correctly.
What should have happened:
Zctl should print an error if the subscription file
you are trying to load doesn't exist, or if for
some other reason it can't read it (e.g., expired
tokens, etc.) Here is a fix.
*** /source/athena/athena.lib/zephyr/clients/zctl/zctl.c Thu Apr 29 14:24:52 1993
--- zctl.c Wed Sep 8 21:06:42 1993
***************
*** 681,691 ****
fp = fopen(file,"r");
ind = unind = 0;
lineno = 1;
! if (fp) for (;;lineno++) {
if (!fgets(subline,sizeof subline,fp))
break;
if (*subline == '#' || !*subline)
--- 681,696 ----
fp = fopen(file,"r");
+ if (fp == NULL) {
+ ss_perror(sci_idx,errno,
+ "while loading subscription file");
+ return;
+ }
ind = unind = 0;
lineno = 1;
! for (;;lineno++) {
if (!fgets(subline,sizeof subline,fp))
break;
if (*subline == '#' || !*subline)
***************
*** 804,811 ****
}
}
cleanup:
! if (fp)
! (void) fclose(fp); /* ignore errs--file is read-only */
return;
}
--- 809,815 ----
}
}
cleanup:
! (void) fclose(fp); /* ignore errs--file is read-only */
return;
}
Please describe any relevant documentation references:
zctl(1)