From bdc7e43117706d0aa46d3b6435489e9d4c2b0888 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Thu, 14 Apr 2005 05:41:59 +0000 Subject: [PATCH] support-named-pipe-logs-20050414 so log files can be named pipes --- src/bozo/bosserver.c | 8 +++++++- src/util/serverLog.c | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/bozo/bosserver.c b/src/bozo/bosserver.c index e08881050a..c5bbf8b117 100644 --- a/src/bozo/bosserver.c +++ b/src/bozo/bosserver.c @@ -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 */ diff --git a/src/util/serverLog.c b/src/util/serverLog.c index e0e97d61f3..edf938632e 100644 --- a/src/util/serverLog.c +++ b/src/util/serverLog.c @@ -44,6 +44,7 @@ RCSID #include #endif #endif +#include #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) {