projects
/
platform
/
upstream
/
libwebsockets.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d12b3df
)
cgi: close unforked std fds
author
Andy Green
<andy@warmcat.com>
Sat, 20 May 2017 00:05:27 +0000
(08:05 +0800)
committer
Andy Green
<andy@warmcat.com>
Sat, 20 May 2017 00:05:27 +0000
(08:05 +0800)
lib/libwebsockets.c
patch
|
blob
|
history
diff --git
a/lib/libwebsockets.c
b/lib/libwebsockets.c
index
11f73d5
..
288c3df
100755
(executable)
--- a/
lib/libwebsockets.c
+++ b/
lib/libwebsockets.c
@@
-2506,11
+2506,13
@@
lws_cgi(struct lws *wsi, const char * const *exec_array, int script_uri_path_len
* process is OK. Stuff that happens after the execvpe() is OK.
*/
- for (n = 0; n < 3; n++)
+ for (n = 0; n < 3; n++)
{
if (dup2(cgi->pipe_fds[n][!(n == 0)], n) < 0) {
lwsl_err("%s: stdin dup2 failed\n", __func__);
goto bail3;
}
+ close(cgi->pipe_fds[n][!(n == 0)]);
+ }
#if !defined(LWS_HAVE_VFORK) || !defined(LWS_HAVE_EXECVPE)
for (m = 0; m < n; m++) {