|
|
@ -72,13 +72,11 @@ main(){ |
|
|
|
int http_code = HTTP_ERROR; |
|
|
|
int http_code = HTTP_ERROR; |
|
|
|
if (access(DIR, W_OK) != 0) { |
|
|
|
if (access(DIR, W_OK) != 0) { |
|
|
|
fprintf(stderr, "Directory %s does not exist or is not writable\n", DIR); |
|
|
|
fprintf(stderr, "Directory %s does not exist or is not writable\n", DIR); |
|
|
|
http_code = HTTP_ERROR; |
|
|
|
|
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
// first chdir() and then chroot()!
|
|
|
|
// first chdir() and then chroot()!
|
|
|
|
if (!( chdir(DIR) == 0 && chroot(DIR) == 0 )) { |
|
|
|
if (!( chdir(DIR) == 0 && chroot(DIR) == 0 )) { |
|
|
|
fprintf(stderr, "Cannot chdir and chroot into %s\n", DIR); |
|
|
|
fprintf(stderr, "Cannot chdir and chroot into %s\n", DIR); |
|
|
|
http_code = HTTP_ERROR; |
|
|
|
|
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
while(FCGI_Accept() >= 0) { |
|
|
|
while(FCGI_Accept() >= 0) { |
|
|
|