]> granicus.if.org Git - apache/commitdiff
Ease migration for the hosts of piped loggers out there, handle the
authorWilliam A. Rowe Jr <wrowe@apache.org>
Fri, 15 May 2009 20:40:24 +0000 (20:40 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Fri, 15 May 2009 20:40:24 +0000 (20:40 +0000)
log process selection (| vs $ vs default) in ap_open_piped_log

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@775320 13f79535-47bb-0310-9956-ffa450edef68

server/log.c

index d192723d9a0eab94219278d61c6b3b90f28522d4..2c34f316b96a48cf74c3a696697d285e6bd76f35 100644 (file)
@@ -1102,7 +1102,21 @@ AP_DECLARE(piped_log *) ap_open_piped_log_ex(apr_pool_t *p,
 AP_DECLARE(piped_log *) ap_open_piped_log(apr_pool_t *p,
                                           const char *program)
 {
-   return ap_open_piped_log_ex(p, program, APR_PROGRAM_ENV);
+    apr_cmdtype_e cmdtype = APR_PROGRAM_ENV;
+
+    /* In 2.4 favor PROGRAM_ENV, accept "||prog" syntax for compatibility
+     * and "|$cmd" to override the default.
+     * Any 2.2 backport would continue to favor SHELLCMD_ENV so there 
+     * accept "||prog" to override, and "|$cmd" to ease conversion.
+     */
+    if (*program == '|')
+        ++program;
+    if (*program == '$') {
+        cmdtype = APR_SHELLCMD_ENV;
+        ++program;
+    }
+
+    return ap_open_piped_log_ex(p, program, cmdtype);
 }
 
 AP_DECLARE(void) ap_close_piped_log(piped_log *pl)