projects
/
project
/
uhttpd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ae3fe30
)
properly handle return codes
author
John Crispin
<blogic@openwrt.org>
Sat, 28 Mar 2015 16:25:40 +0000
(17:25 +0100)
committer
John Crispin
<blogic@openwrt.org>
Sat, 28 Mar 2015 17:37:56 +0000
(18:37 +0100)
Signed-off-by: John Crispin <blogic@openwrt.org>
cgi.c
patch
|
blob
|
history
diff --git
a/cgi.c
b/cgi.c
index a2a7e508ecdb37d79c6174fc74b614e7c7b22327..dc302a9acf32c28d3869ca63176ff418dcd7880c 100644
(file)
--- a/
cgi.c
+++ b/
cgi.c
@@
-52,12
+52,12
@@
static void cgi_main(struct client *cl, struct path_info *pi, char *url)
setenv(var->name, var->value, 1);
}
- chdir(pi->root);
-
- if (ip)
- e
xecl(ip->path, ip->path, pi->phys, NULL);
- else
- execl(pi->phys, pi->phys, NULL);
+ if (!chdir(pi->root)) {
+ if (ip)
+ execl(ip->path, ip->path, pi->phys, NULL);
+ e
lse
+ execl(pi->phys, pi->phys, NULL);
+ }
printf("Status: 500 Internal Server Error\r\n\r\n"
"Unable to launch the requested CGI program:\n"