diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-08 15:21:55 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-08 15:21:55 +0000 |
commit | 7dbf1b4d9eb0eca9c98cfdd0d37d6ce3b8f09e0c (patch) | |
tree | dd01374382cb0e98b1e508dfd864224f211c4a78 | |
parent | afdad653ac62e99d8da30e441d3414684146db19 (diff) | |
download | busybox-w32-7dbf1b4d9eb0eca9c98cfdd0d37d6ce3b8f09e0c.tar.gz busybox-w32-7dbf1b4d9eb0eca9c98cfdd0d37d6ce3b8f09e0c.tar.bz2 busybox-w32-7dbf1b4d9eb0eca9c98cfdd0d37d6ce3b8f09e0c.zip |
httpd: add a bit of error logging; a few code simplifications. +29 bytes.
-rw-r--r-- | networking/httpd.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/networking/httpd.c b/networking/httpd.c index 0f18b0fd0..3ac9b906a 100644 --- a/networking/httpd.c +++ b/networking/httpd.c | |||
@@ -1419,8 +1419,9 @@ static void send_cgi_and_exit( | |||
1419 | 1419 | ||
1420 | /* script must have absolute path */ | 1420 | /* script must have absolute path */ |
1421 | script = strrchr(fullpath, '/'); | 1421 | script = strrchr(fullpath, '/'); |
1422 | if (!script) | 1422 | //fullpath is a result of concat_path_file and always has '/' |
1423 | goto error_execing_cgi; | 1423 | //if (!script) |
1424 | // goto error_execing_cgi; | ||
1424 | *script = '\0'; | 1425 | *script = '\0'; |
1425 | /* chdiring to script's dir */ | 1426 | /* chdiring to script's dir */ |
1426 | if (chdir(fullpath) == 0) { | 1427 | if (chdir(fullpath) == 0) { |
@@ -1441,16 +1442,19 @@ static void send_cgi_and_exit( | |||
1441 | #endif | 1442 | #endif |
1442 | *script = '/'; | 1443 | *script = '/'; |
1443 | /* set argv[0] to name without path */ | 1444 | /* set argv[0] to name without path */ |
1444 | argv[0] = (char*)bb_basename(purl); | 1445 | argv[0] = script + 1; |
1445 | argv[1] = NULL; | 1446 | argv[1] = NULL; |
1446 | #if ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR | 1447 | #if ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR |
1447 | if (interpr) | 1448 | if (interpr) |
1448 | execv(interpr, argv); | 1449 | fullpath = interpr; |
1449 | else | ||
1450 | #endif | 1450 | #endif |
1451 | execv(fullpath, argv); | 1451 | execv(fullpath, argv); |
1452 | if (verbose) | ||
1453 | bb_perror_msg("exec %s", fullpath); | ||
1454 | } else if (verbose) { | ||
1455 | bb_perror_msg("chdir %s", fullpath); | ||
1452 | } | 1456 | } |
1453 | error_execing_cgi: | 1457 | //error_execing_cgi: |
1454 | /* send to stdout | 1458 | /* send to stdout |
1455 | * (we are CGI here, our stdout is pumped to the net) */ | 1459 | * (we are CGI here, our stdout is pumped to the net) */ |
1456 | send_headers_and_exit(HTTP_NOT_FOUND); | 1460 | send_headers_and_exit(HTTP_NOT_FOUND); |