SOURCES: pound-logfile.patch (NEW) - add LogFile directive support, opens s...

glen glen at pld-linux.org
Wed Dec 10 23:59:03 CET 2008


Author: glen                         Date: Wed Dec 10 22:59:03 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- add LogFile directive support, opens stdout there if defined

---- Files affected:
SOURCES:
   pound-logfile.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/pound-logfile.patch
diff -u /dev/null SOURCES/pound-logfile.patch:1.1
--- /dev/null	Wed Dec 10 23:59:04 2008
+++ SOURCES/pound-logfile.patch	Wed Dec 10 23:58:58 2008
@@ -0,0 +1,80 @@
+--- Pound-2.4.3/config.c	2008-12-11 00:55:24.275734964 +0200
++++ Pound-2.4.3-logfile/config.c	2008-12-11 00:22:22.509353295 +0200
+@@ -72,7 +72,7 @@
+ };
+ #endif
+ 
+-static regex_t  Empty, Comment, User, Group, RootJail, Daemon, LogFacility, LogLevel, Alive, SSLEngine, Control;
++static regex_t  Empty, Comment, User, Group, RootJail, Daemon, LogFacility, LogFile, LogLevel, Alive, SSLEngine, Control;
+ static regex_t  ListenHTTP, ListenHTTPS, End, Address, Port, Cert, xHTTP, Client, CheckURL;
+ static regex_t  Err414, Err500, Err501, Err503, MaxRequest, HeadRemove, RewriteLocation, RewriteDestination;
+ static regex_t  Service, ServiceName, URL, HeadRequire, HeadDeny, BackEnd, Emergency, Priority, HAport, HAportAddr;
+@@ -1104,6 +1104,14 @@
+                         def_facility = facilitynames[i].c_val;
+                         break;
+                     }
++        } else if(!regexec(&LogFile, lin, 4, matches, 0)) {
++            lin[matches[1].rm_eo] = '\0';
++            if((log_file = strdup(lin + matches[1].rm_so)) == NULL) {
++                logmsg(LOG_ERR, "line %d: LogFile config: out of memory - aborted", n_lin);
++                exit(1);
++            }
++			// force facility to log stdout internally.
++			def_facility = -1;
+         } else if(!regexec(&Grace, lin, 4, matches, 0)) {
+             grace = atoi(lin + matches[1].rm_so);
+         } else if(!regexec(&LogLevel, lin, 4, matches, 0)) {
+@@ -1204,6 +1212,7 @@
+     || regcomp(&RootJail, "^[ \t]*RootJail[ \t]+\"(.+)\"[ \t]*$", REG_ICASE | REG_NEWLINE | REG_EXTENDED)
+     || regcomp(&Daemon, "^[ \t]*Daemon[ \t]+([01])[ \t]*$", REG_ICASE | REG_NEWLINE | REG_EXTENDED)
+     || regcomp(&LogFacility, "^[ \t]*LogFacility[ \t]+([a-z0-9-]+)[ \t]*$", REG_ICASE | REG_NEWLINE | REG_EXTENDED)
++    || regcomp(&LogFile, "^[ \t]*LogFile[ \t]+(.+)[ \t]*$", REG_ICASE | REG_NEWLINE | REG_EXTENDED)
+     || regcomp(&LogLevel, "^[ \t]*LogLevel[ \t]+([0-5])[ \t]*$", REG_ICASE | REG_NEWLINE | REG_EXTENDED)
+     || regcomp(&Grace, "^[ \t]*Grace[ \t]+([0-9]+)[ \t]*$", REG_ICASE | REG_NEWLINE | REG_EXTENDED)
+     || regcomp(&Alive, "^[ \t]*Alive[ \t]+([1-9][0-9]*)[ \t]*$", REG_ICASE | REG_NEWLINE | REG_EXTENDED)
+@@ -1329,6 +1338,7 @@
+     group = NULL;
+     root_jail = NULL;
+     ctrl_name = NULL;
++    log_file = NULL;
+ 
+     alive_to = 30;
+     daemonize = 1;
+@@ -1358,6 +1368,7 @@
+     regfree(&RootJail);
+     regfree(&Daemon);
+     regfree(&LogFacility);
++    regfree(&LogFile);
+     regfree(&LogLevel);
+     regfree(&Grace);
+     regfree(&Alive);
+--- Pound-2.4.3/pound.c	2008-05-31 13:25:43.000000000 +0300
++++ Pound-2.4.3-logfile/pound.c	2008-12-11 00:51:21.169092412 +0200
+@@ -33,6 +33,7 @@
+             *group,             /* group to run as */
+             *root_jail,         /* directory to chroot to */
+             *pid_name,          /* file to record pid in */
++            *log_file,          /* print log messages to this file */
+             *ctrl_name;         /* control socket name */
+ 
+ int         alive_to,           /* check interval for resurrection */
+@@ -294,6 +295,9 @@
+                     close(0);
+                     close(1);
+                     close(2);
++                } else if (log_file) {
++                    freopen(log_file, "a", stdout);
++                    setlinebuf(stdout);
+                 }
+                 break;
+             case -1:
+--- Pound-2.4.3/pound.h	2008-05-31 13:25:43.000000000 +0300
++++ Pound-2.4.3-logfile/pound.h	2008-12-11 00:16:43.449299956 +0200
+@@ -236,6 +236,7 @@
+             *group,             /* group to run as */
+             *root_jail,         /* directory to chroot to */
+             *pid_name,          /* file to record pid in */
++            *log_file,          /* print log messages to this file */
+             *ctrl_name;         /* control socket name */
+ 
+ extern int  alive_to,           /* check interval for resurrection */
================================================================


More information about the pld-cvs-commit mailing list