aboutsummaryrefslogtreecommitdiffstats
path: root/src/blogc-runserver/httpd.c
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2018-12-17 21:55:46 +0100
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2018-12-17 21:55:46 +0100
commit91737269d67a0403727faaa70521ff904dba695b (patch)
treeb5c431f12f0a04c1b7a8a00a27a3e745f9815808 /src/blogc-runserver/httpd.c
parent3f58386ebd99fe980b35487ceb721fedcce73ac5 (diff)
downloadblogc-91737269d67a0403727faaa70521ff904dba695b.tar.gz
blogc-91737269d67a0403727faaa70521ff904dba695b.tar.bz2
blogc-91737269d67a0403727faaa70521ff904dba695b.zip
git-receiver: make: runserver: improved realpath(3) usage
Diffstat (limited to 'src/blogc-runserver/httpd.c')
-rw-r--r--src/blogc-runserver/httpd.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/blogc-runserver/httpd.c b/src/blogc-runserver/httpd.c
index 274aa5e..6cbd198 100644
--- a/src/blogc-runserver/httpd.c
+++ b/src/blogc-runserver/httpd.c
@@ -102,8 +102,14 @@ handle_request(void *arg)
free(abs_path);
if (real_path == NULL) {
- status_code = 404;
- error(client_socket, 404, "Not Found");
+ if (errno == ENOENT) {
+ status_code = 404;
+ error(client_socket, 404, "Not Found");
+ }
+ else {
+ status_code = 500;
+ error(client_socket, 500, "Internal Server Error");
+ }
goto point2;
}