tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: syslog.conf format (Re: SoC: Improve syslogd)



Christos Zoulas schrieb:
The problem is backwards compatibility. If I change the syntax (from |
to >), lots of configurations would be broken. So I can not do that.
Can't you just stat the destination and if it is a fifo and it has | warn
for a version or two?

I would guess Linux users do not want this change, -- because for them "it has always been that way"...

One could just as well ask if BSD wanted to allow fifos after a '|'. (Which would be easy enough, since they could simply be treated as files.)

--
Martin
--- syslogd/syslogd.c   2006-11-13 21:24:00.000000000 +0100
+++ syslogdfifo/syslogd.c       2008-06-10 23:02:53.000000000 +0200
@@ -1867,6 +1867,7 @@
        int    error, i, pri, syncfile;
        char   *bp, *p, *q;
        char   buf[MAXLINE];
+       struct stat sb;

        dprintf("cfline(\"%s\", f, \"%s\", \"%s\")\n", line, prog, host);

@@ -2044,6 +2045,16 @@
                NumForwards++;
                break;

+       case '|':
+               if (stat(p+1, &sb) || !S_ISFIFO(sb.st_mode) ) {
+                       f->f_un.f_pipe.f_pid = 0;
+                       (void) strlcpy(f->f_un.f_pipe.f_pname, p + 1,
+                           sizeof(f->f_un.f_pipe.f_pname));
+                       f->f_type = F_PIPE;
+                       break;
+               }
+               p++;
+               /* got a fifo. fallthrough */
        case '/':
                (void)strlcpy(f->f_un.f_fname, p, sizeof(f->f_un.f_fname));
                if ((f->f_file = open(p, O_WRONLY|O_APPEND, 0)) < 0) {
@@ -2061,13 +2072,6 @@
                        f->f_type = F_CONSOLE;
                break;

-       case '|':
-               f->f_un.f_pipe.f_pid = 0;
-               (void) strlcpy(f->f_un.f_pipe.f_pname, p + 1,
-                   sizeof(f->f_un.f_pipe.f_pname));
-               f->f_type = F_PIPE;
-               break;
-
        case '*':
                f->f_type = F_WALL;
                break;



Home | Main Index | Thread Index | Old Index