]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE14-support-named-pipe-logs-20050414
authorDerrick Brashear <shadow@dementia.org>
Thu, 14 Apr 2005 05:42:59 +0000 (05:42 +0000)
committerDerrick Brashear <shadow@dementia.org>
Thu, 14 Apr 2005 05:42:59 +0000 (05:42 +0000)
so log files can be named pipes

(cherry picked from commit bdc7e43117706d0aa46d3b6435489e9d4c2b0888)

src/bozo/bosserver.c
src/util/serverLog.c

index e08881050a476635fda3354fb046d897ca9134bd..c5bbf8b11704756e77716f100d4a1d180221a5ed 100644 (file)
@@ -718,6 +718,7 @@ main(int argc, char **argv, char **envp)
     char namebuf[AFSDIR_PATH_MAX];
 #ifndef AFS_NT40_ENV
     int nofork = 0;
+    struct stat sb;
 #endif
 #ifdef AFS_AIX32_ENV
     struct sigaction nsa;
@@ -863,7 +864,12 @@ main(int argc, char **argv, char **envp)
        background();
 #endif /* ! AFS_NT40_ENV */
 
-    if (!DoSyslog) {
+    if ((!DoSyslog)
+#ifndef AFS_NT40_ENV
+       && (!(fstat(AFSDIR_BOZLOG_FILE, &sb) == 0) && 
+       (S_ISFIFO(sb.st_mode)))
+#endif
+       ) {
        strcpy(namebuf, AFSDIR_BOZLOG_FILE);
        strcat(namebuf, ".old");
        renamefile(AFSDIR_BOZLOG_FILE, namebuf);        /* try rename first */
index e0e97d61f38fcbc147b6973f83cf360b16a0d4e0..edf938632e6b812d7fe6b9529386b0413a8e2cd4 100644 (file)
@@ -44,6 +44,7 @@ RCSID
 #include <strings.h>
 #endif
 #endif
+#include <sys/stat.h>
 #include "afsutil.h"
 #include "fileutil.h"
 #if defined(AFS_PTHREAD_ENV)
@@ -228,10 +229,16 @@ OpenLog(const char *fileName)
     char FileName[MAXPATHLEN];
 
 #ifndef AFS_NT40_ENV
+    struct stat statbuf;
+
     if (serverLogSyslog) {
        openlog(serverLogSyslogTag, LOG_PID, serverLogSyslogFacility);
        return (0);
     }
+
+    /* Support named pipes as logs by not rotating them */
+    if ((fstat(fileName, &statbuf) == 0)  && (S_ISFIFO(statbuf.st_mode))) 
+           return (0);
 #endif
 
     if (mrafsStyleLogs) {