date and time created 83/08/05 13:35:19 by sam
[unix-history] / usr / src / old / implogd / implogd.c
index dce5bec..87caaaf 100644 (file)
@@ -1,10 +1,10 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)implogd.c  4.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)implogd.c  4.8 (Berkeley) %G%";
 #endif
 
 #endif
 
-#include <time.h>
 #include <sgtty.h>
 
 #include <sgtty.h>
 
+#include <sys/time.h>
 #include <sys/param.h>
 #include <sys/socket.h>
 #include <sys/file.h>
 #include <sys/param.h>
 #include <sys/socket.h>
 #include <sys/file.h>
@@ -58,7 +58,7 @@ main(argc, argv)
          }
        }
 #endif
          }
        }
 #endif
-       log = open(LOGFILE, FCREATE|FWRONLY|FAPPEND, 0644);
+       log = open(LOGFILE, O_CREAT|O_WRONLY|O_APPEND, 0644);
        if (log < 0) {
                perror("implogd: open");
                exit(1);
        if (log < 0) {
                perror("implogd: open");
                exit(1);
@@ -71,13 +71,15 @@ main(argc, argv)
                sleep(5);
        }
        for (;;) {
                sleep(5);
        }
        for (;;) {
-               int len = sizeof (request);
+               int fromlen = sizeof (from), len;
 
 
-               if (recvfrom(s, request, &len, 0, &from, sizeof (from)) < 0) {
+               len = recvfrom(s, request, sizeof (request), 0,
+                       &from, &fromlen);
+               if (len < 0) {
                        perror("implogd: recvfrom");
                        continue;
                }
                        perror("implogd: recvfrom");
                        continue;
                }
-               if (len <= 0 || len > IMPMTU)   /* sanity */
+               if (len == 0 || len > IMPMTU)   /* sanity */
                        continue;
                from.sin_len = len;
                from.sin_time = time(0);
                        continue;
                from.sin_len = len;
                from.sin_time = time(0);