summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2020-01-23 19:24:51 -0500
committerGlenn Strauss <gstrauss@gluelogic.com>2020-01-26 00:41:06 -0500
commit12aa0f4c9162120a84125ec77e226c6f447e41bd (patch)
tree7f4b5c1932210cd13a8e25b7941d13102b577d44
parentfb74bb75148142d622b665275b1bb7751abf1a5a (diff)
downloadlighttpd-1.x-12aa0f4c9162120a84125ec77e226c6f447e41bd.tar.gz
lighttpd-1.x-12aa0f4c9162120a84125ec77e226c6f447e41bd.zip
[core] save errno before logging if execve() fails
(fdevent_fork_execve())
-rw-r--r--src/fdevent.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/fdevent.c b/src/fdevent.c
index b6cc7d88..bdea3596 100644
--- a/src/fdevent.c
+++ b/src/fdevent.c
@@ -769,12 +769,13 @@ pid_t fdevent_fork_execve(const char *name, char *argv[], char *envp[], int fdin
execve(name, argv, envp ? envp : environ);
+ int errnum = errno;
if (0 == memcmp(argv[0], "/bin/sh", sizeof("/bin/sh")-1)
&& argv[1] && 0 == memcmp(argv[1], "-c", sizeof("-c")-1))
perror(argv[2]);
else
perror(argv[0]);
- _exit(errno);
+ _exit(errnum);
#else