BSD 4_3 release
[unix-history] / usr / src / lib / libc / gen / syslog.c
index 9b1ad28..f0dcc80 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)syslog.c   5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)syslog.c   5.9 (Berkeley) 5/7/86";
 #endif LIBC_SCCS and not lint
 
 /*
 #endif LIBC_SCCS and not lint
 
 /*
@@ -28,9 +28,10 @@ static char sccsid[] = "@(#)syslog.c 5.6 (Berkeley) %G%";
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/file.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/file.h>
-#include <signal.h>
-#include <syslog.h>
+#include <sys/signal.h>
+#include <sys/syslog.h>
 #include <netdb.h>
 #include <netdb.h>
+#include <strings.h>
 
 #define        MAXLINE 1024                    /* max message size */
 #define NULL   0                       /* manifest */
 
 #define        MAXLINE 1024                    /* max message size */
 #define NULL   0                       /* manifest */
@@ -121,7 +122,7 @@ syslog(pri, fmt, p0, p1, p2, p3, p4)
        /* output the message to the local logger */
        if (sendto(LogFile, outline, c, 0, &SyslogAddr, sizeof SyslogAddr) >= 0)
                return;
        /* output the message to the local logger */
        if (sendto(LogFile, outline, c, 0, &SyslogAddr, sizeof SyslogAddr) >= 0)
                return;
-       if (!(LogStat & LOG_CONS) && (pri & LOG_PRIMASK) <= LOG_ERR)
+       if (!(LogStat & LOG_CONS))
                return;
 
        /* output the message to the console */
                return;
 
        /* output the message to the console */
@@ -129,19 +130,22 @@ syslog(pri, fmt, p0, p1, p2, p3, p4)
        if (pid == -1)
                return;
        if (pid == 0) {
        if (pid == -1)
                return;
        if (pid == 0) {
+               int fd;
+
                signal(SIGALRM, SIG_DFL);
                sigsetmask(sigblock(0) & ~sigmask(SIGALRM));
                alarm(5);
                signal(SIGALRM, SIG_DFL);
                sigsetmask(sigblock(0) & ~sigmask(SIGALRM));
                alarm(5);
-               LogFile = open(ctty, O_WRONLY);
+               fd = open(ctty, O_WRONLY);
                alarm(0);
                strcat(o, "\r");
                alarm(0);
                strcat(o, "\r");
-               o = outline + index(outline, '>') + 1;
-               write(LogFile, outline, c + 1 - (o - outline));
-               close(LogFile);
-               exit(0);
+               o = index(outline, '>') + 1;
+               write(fd, o, c + 1 - (o - outline));
+               close(fd);
+               _exit(0);
        }
        }
-       while ((c = wait((int *)0)) > 0 && c != pid)
-               ;
+       if (!(LogStat & LOG_NOWAIT))
+               while ((c = wait((int *)0)) > 0 && c != pid)
+                       ;
 }
 
 /*
 }
 
 /*