[52] in Zephyr_Bugs
vax 7.0F: zhm
daemon@ATHENA.MIT.EDU (Barr3y Jaspan)
Mon Jul 2 15:06:40 1990
To: bug-zephyr@ATHENA.MIT.EDU
Date: Mon, 02 Jul 90 15:06:12 EDT
From: Barr3y Jaspan <bjaspan@MIT.EDU>
(This is marc)
What were you trying to do?
port zhm
What's wrong:
/* kill old hm if it exists */
fp = fopen(PidFile, "r");
if (fp != NULL) {
(void)fscanf(fp, "%d\n", &oldpid);
while (!kill(oldpid, SIGTERM))
sleep(1);
syslog(LOG_INFO, "Killed old image.");
(void) fclose(fp);
}
What should have happened:
The program shouldn't have committed suicide. If zhm.pid is
empty, the oldpid won't get set properly. In fact, oldpid == 0 on
this machine, so the zhm kills itself. Neat bug :-)
The code should check the return value of fscanf(). If it's
!= 1, don't do the kill, and error somehow. (Yes, I know I'll
probably end up writing the code anyway.)
Marc