From f23a24a263531501374f07de4b18344886f00a8c Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Sun, 14 Feb 2016 11:11:15 +0000 Subject: [PATCH] [mod_cgi] issue trace and exit if execve() fails (closes #2302) (replace SEGFAULT if execve() fails) From: Glenn Strauss git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3079 152afb58-edef-0310-8abb-c4023f1b3aa9 --- NEWS | 1 + src/mod_cgi.c | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index d9ba9a5d..578c22a4 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,7 @@ NEWS * [mod_cgi] use MAP_PRIVATE to mmap temporary file (fixes #2715) * [core] do not send SIGHUP to process group unless server.max-workers is used (fixes #2711) * [mod_cgi] edge case chdir "/" when docroot "/" (fixes #2460) + * [mod_cgi] issue trace and exit if execve() fails (closes #2302) - 1.4.39 - 2016-01-02 * [core] fix memset_s call (fixes #2698) diff --git a/src/mod_cgi.c b/src/mod_cgi.c index 83caad57..bfbfa13c 100644 --- a/src/mod_cgi.c +++ b/src/mod_cgi.c @@ -1095,11 +1095,10 @@ static int cgi_create_env(server *srv, connection *con, plugin_data *p, buffer * /* exec the cgi */ execve(args[0], args, env.ptr); - /* log_error_write(srv, __FILE__, __LINE__, "sss", "CGI failed:", strerror(errno), args[0]); */ - - /* */ - SEGFAULT(); - break; + /* most log files may have been closed/redirected by this point, + * though stderr might still point to lighttpd.breakage.log */ + perror(args[0]); + _exit(1); } case -1: /* error */