]> granicus.if.org Git - apache/commitdiff
Fix the null device name on Windows so that stderr can be sent
authorJeff Trawick <trawick@apache.org>
Fri, 27 Sep 2013 18:01:15 +0000 (18:01 +0000)
committerJeff Trawick <trawick@apache.org>
Fri, 27 Sep 2013 18:01:15 +0000 (18:01 +0000)
to the bit bucket.  (This logic is always hit when using an error
log provider.)

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

server/log.c

index d2318b81da43de9d2efd79dc5433eb3344ef8789..9466847d98283ccc1e26a7af2844aed002c1133a 100644 (file)
@@ -430,9 +430,16 @@ int ap_open_logs(apr_pool_t *pconf, apr_pool_t *p /* plog */,
      * XXX: This is BS - /dev/null is non-portable
      *      errno-as-apr_status_t is also non-portable
      */
-    if (replace_stderr && freopen("/dev/null", "w", stderr) == NULL) {
+
+#ifdef WIN32
+#define NULL_DEVICE "nul"
+#else
+#define NULL_DEVICE "/dev/null"
+#endif
+
+    if (replace_stderr && freopen(NULL_DEVICE, "w", stderr) == NULL) {
         ap_log_error(APLOG_MARK, APLOG_CRIT, errno, s_main, APLOGNO(00093)
-                     "unable to replace stderr with /dev/null");
+                     "unable to replace stderr with %s", NULL_DEVICE);
     }
 
     for (virt = s_main->next; virt; virt = virt->next) {