Ticket #165: lighttpd-1.4.15-stderr.patch

File lighttpd-1.4.15-stderr.patch, 1.1 kB (added by spillgroup, 14 months ago)
  • src/server.c

    diff -Nur ../lighttpd-1.4.15/src/server.c ./src/server.c
    old new  
    843843                write(pid_fd, srv->tmp_buf->ptr, srv->tmp_buf->used - 1); 
    844844                close(pid_fd); 
    845845                pid_fd = -1; 
    846         } 
     846        } 
     847 
     848    //Close stderr ASAP in the child process to make sure that nothing 
     849    //is being written to that fd which may not be valid anymore. 
     850        if (-1 == log_error_open(srv)) { 
     851                log_error_write(srv, __FILE__, __LINE__, "s", 
     852                                "opening errorlog failed, dying"); 
     853 
     854                plugins_free(srv); 
     855                network_close(srv); 
     856                server_free(srv); 
     857                return -1; 
     858        } 
    847859 
    848860        if (HANDLER_GO_ON != plugins_call_set_defaults(srv)) { 
    849861                log_error_write(srv, __FILE__, __LINE__, "s", "Configuration of plugins failed. Going down."); 
     
    895907                return -1; 
    896908        } 
    897909 
    898         if (-1 == log_error_open(srv)) { 
    899                 log_error_write(srv, __FILE__, __LINE__, "s", 
    900                                 "opening errorlog failed, dying"); 
    901910 
    902                 plugins_free(srv); 
    903                 network_close(srv); 
    904                 server_free(srv); 
    905                 return -1; 
    906         } 
    907911 
    908912 
    909913#ifdef HAVE_SIGACTION