add check for failure to fopen shutdownlog
authorBill Joy <root@ucbvax.Berkeley.EDU>
Tue, 21 Apr 1981 17:07:16 +0000 (09:07 -0800)
committerBill Joy <root@ucbvax.Berkeley.EDU>
Tue, 21 Apr 1981 17:07:16 +0000 (09:07 -0800)
SCCS-vsn: sbin/reboot/reboot.c 4.5

usr/src/sbin/reboot/reboot.c

index ea4bee1..3f662d9 100644 (file)
@@ -1,4 +1,4 @@
-static char *sccsid = "@(#)reboot.c    4.4 (Berkeley) %G%";
+static char *sccsid = "@(#)reboot.c    4.5 (Berkeley) %G%";
 /*
  * Reboot
  */
 /*
  * Reboot
  */
@@ -124,6 +124,8 @@ log_entry()
        time(&now);
        tm = localtime(&now);
        fp = fopen(SHUTDOWNLOG, "a");
        time(&now);
        tm = localtime(&now);
        fp = fopen(SHUTDOWNLOG, "a");
+       if (fp == 0)
+               return;
        fseek(fp, 0L, 2);
        fprintf(fp, "%02d:%02d  %s %s %2d, %4d.  Halted for reboot.\n", tm->tm_hour,
                tm->tm_min, days[tm->tm_wday], months[tm->tm_mon],
        fseek(fp, 0L, 2);
        fprintf(fp, "%02d:%02d  %s %s %2d, %4d.  Halted for reboot.\n", tm->tm_hour,
                tm->tm_min, days[tm->tm_wday], months[tm->tm_mon],