You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ni...@apache.org on 2013/10/19 13:01:12 UTC

svn commit: r1533728 - in /httpd/httpd/trunk: CHANGES server/main.c

Author: niq
Date: Sat Oct 19 11:01:11 2013
New Revision: 1533728

URL: http://svn.apache.org/r1533728
Log:
PR 55670
Don't risk failing silently at startup when running in a tty.

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/server/main.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1533728&r1=1533727&r2=1533728&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sat Oct 19 11:01:11 2013
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) core: ensure any abnormal exit is reported to stderr if it's a tty.
+     PR 55670 [Nick Kew]
+
   *) mod_proxy: Added support for unix domain sockets as the
      backend server endpoint [Jim Jagielski, Blaise Tarr
      <blaise tarr gmail com>]

Modified: httpd/httpd/trunk/server/main.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/main.c?rev=1533728&r1=1533727&r2=1533728&view=diff
==============================================================================
--- httpd/httpd/trunk/server/main.c (original)
+++ httpd/httpd/trunk/server/main.c Sat Oct 19 11:01:11 2013
@@ -43,6 +43,11 @@
 
 #if APR_HAVE_UNISTD_H
 #include <unistd.h>
+#else
+/* Not sure what absence of unistd would signify for tty.  Treating it as a
+ * big NO is safe, as we then won't try to write to stderr that's not a tty.
+ */
+#define isatty(n) (0)
 #endif
 
 /* WARNING: Win32 binds http_main.c dynamically to the server. Please place
@@ -263,6 +268,10 @@ static void destroy_and_exit_process(pro
     ap_main_state = AP_SQ_MS_EXITING;
     apr_pool_destroy(process->pool); /* and destroy all descendent pools */
     apr_terminate();
+    if ((process_exit_value != 0) && isatty(fileno(stderr))) {
+        const char *name = process->short_name ? process->short_name : "httpd";
+        fprintf(stderr, "%s: abnormal exit %d\n", name, process_exit_value);
+    }
     exit(process_exit_value);
 }