Yogi.123/update busybox/busybox-syslog-p.diff

From ReelBox Maniacs

Jump to: navigation, search
diff -Nur busybox-svn-14689/include/usage.h busybox-reel/include/usage.h
--- busybox-svn-14689/include/usage.h   2006-03-27 09:41:45.000000000 +0200
+++ busybox-reel/include/usage.h        2006-03-29 19:24:12.000000000 +0200
@@ -2951,6 +2951,7 @@
        "Options:\n" \
        "\t-m MIN\t\tMinutes between MARK lines (default=20, 0=off)\n" \
        "\t-n\t\tRun as a foreground process\n" \
+       "\t-p FILE\t\tUse and alternate log socket (default=/dev/log)\n" \
        "\t-O FILE\t\tUse an alternate log file (default=/var/log/messages)\n" \
        "\t-S\t\tMake logging output smaller." \
        USAGE_ROTATE_LOGFILE( \
diff -Nur busybox-svn-14689/sysklogd/syslogd.c busybox-reel/sysklogd/syslogd.c
--- busybox-svn-14689/sysklogd/syslogd.c        2006-03-09 09:52:05.000000000 +0100
+++ busybox-reel/sysklogd/syslogd.c     2006-03-29 19:24:12.000000000 +0200
@@ -44,6 +44,7 @@

 /* Path to the unix socket */
 static char lfile[MAXPATHLEN];
+static const char *logSockPath = _PATH_LOG;

 static const char *logFilePath = __LOG_FILE;

@@ -536,7 +537,7 @@
        alarm(MarkInterval);

        /* Create the syslog file so realpath() can work. */
-       if (realpath(_PATH_LOG, lfile) != NULL) {
+       if (realpath(logSockPath, lfile) != NULL) {
                unlink(lfile);
        }

@@ -544,17 +545,16 @@
        sunx.sun_family = AF_UNIX;
        strncpy(sunx.sun_path, lfile, sizeof(sunx.sun_path));
        if ((sock_fd = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0) {
-               bb_perror_msg_and_die("Couldn't get file descriptor for socket "
-                                                  _PATH_LOG);
+               bb_perror_msg_and_die("Couldn't get file descriptor for socket %s", logSockPath);
        }

        addrLength = sizeof(sunx.sun_family) + strlen(sunx.sun_path);
        if (bind(sock_fd, (struct sockaddr *) &sunx, addrLength) < 0) {
-               bb_perror_msg_and_die("Could not connect to socket " _PATH_LOG);
+               bb_perror_msg_and_die("Could not connect to socket %s", logSockPath);
        }

        if (chmod(lfile, 0666) < 0) {
-               bb_perror_msg_and_die("Could not set permission on " _PATH_LOG);
+               bb_perror_msg_and_die("Could not set permission on %s", logSockPath);
        }
 #ifdef CONFIG_FEATURE_IPC_SYSLOG
        if (circular_logging == TRUE) {
@@ -611,7 +611,7 @@
        char *p;

        /* do normal option parsing */
-       while ((opt = getopt(argc, argv, "m:nO:s:Sb:R:LC::")) > 0) {
+       while ((opt = getopt(argc, argv, "m:nO:s:p:Sb:R:LC::")) > 0) {
                switch (opt) {
                case 'm':
                        MarkInterval = atoi(optarg) * 60;
@@ -622,6 +622,9 @@
                case 'O':
                        logFilePath = optarg;
                        break;
+               case 'p':
+                       logSockPath = optarg;
+                       break;
 #ifdef CONFIG_FEATURE_ROTATE_LOGFILE
                case 's':
                        logFileSize = atoi(optarg) * 1024;
Personal tools