diff options
author | John Crispin <blogic@openwrt.org> | 2015-03-28 17:25:40 +0100 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2015-03-28 18:37:56 +0100 |
commit | b9178b9357798ae23a5724333cc6572d14f23958 (patch) | |
tree | 35e7a9c46d71e0b9f793d43b646912bb96e884bd | |
parent | ae3fe30b6a1d4a45a34b3a896e9a4997c5da500f (diff) |
properly handle return codes
Signed-off-by: John Crispin <blogic@openwrt.org>
-rw-r--r-- | cgi.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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) - execl(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); + else + execl(pi->phys, pi->phys, NULL); + } printf("Status: 500 Internal Server Error\r\n\r\n" "Unable to launch the requested CGI program:\n" |