OSSP CVS Repository

ossp - Difference in ossp-pkg/sa/sa_test.c versions 1.3 and 1.4
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/sa/sa_test.c 1.3 -> 1.4

--- sa_test.c    2001/10/05 11:40:22     1.3
+++ sa_test.c    2001/10/05 12:56:06     1.4
@@ -3,8 +3,8 @@
 #include <stdlib.h>
 #include <stdarg.h>
 #include <time.h>
-#include <syslog.h>
 #include <sys/utsname.h>
+#include <unistd.h>
 
 #include "sa.h"
 
@@ -62,18 +62,19 @@
     now = time(NULL);
     tm = localtime(&now);
     strftime(caTime, sizeof(caTime), "%b %e %H:%M:%S", tm);
-    if (uname(&uts) == 0) {
-        cpHost = strdup(uts.nodename);
-        if ((cp = strchr(cpHost, '.')) != NULL)
-            *cp = '\0';
-    }
-    else
-        cpHost = strdup("0.0.0.0"); /* FIXME */
+    if (uname(&uts) == -1)
+        die("uname");
+    cpHost = strdup(uts.nodename);
+    if ((cp = strchr(cpHost, '.')) != NULL)
+        *cp = '\0';
     strcpy(caTag, "progname[12]: ");
     if (strlen(caTag) > 32)
         caTag[32] = '\0';
-    sprintf(caBuf, "<%d>%s %s %s%s", LOG_MAIL|LOG_EMERG, caTime, cpHost, caTag, "test");
-    fprintf(stderr, "%s\n", caBuf);
+    sprintf(caBuf, "<16>%s %s %s[%ld]: %s", caTime, cpHost, 
+            argv[0], (long)getpid(), "test for Internet Datagram socket");
+    fprintf(stderr, "Send to syslog: \"%s\"\n", caBuf);
+
+    /* send message to syslogd(8) */
     nBuf = strlen(caBuf);
     if (sa_writeto(sa, caBuf, nBuf, (size_t *)&n, ra) != SA_OK)
         die("sa_writeto");

CVSTrac 2.0.1