Module Name: src
Committed By: shm
Date: Wed Jul 2 13:58:09 UTC 2014
Modified Files:
src/libexec/httpd: bozohttpd.c
Log Message:
Handle ENAMETOOLONG to return 404 error instead of 500.
OK mrg@
To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/libexec/httpd/bozohttpd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/libexec/httpd/bozohttpd.c
diff -u src/libexec/httpd/bozohttpd.c:1.51 src/libexec/httpd/bozohttpd.c:1.52
--- src/libexec/httpd/bozohttpd.c:1.51 Tue Jul 1 13:41:21 2014
+++ src/libexec/httpd/bozohttpd.c Wed Jul 2 13:58:09 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: bozohttpd.c,v 1.51 2014/07/01 13:41:21 shm Exp $ */
+/* $NetBSD: bozohttpd.c,v 1.52 2014/07/02 13:58:09 shm Exp $ */
/* $eterna: bozohttpd.c,v 1.178 2011/11/18 09:21:15 mrg Exp $ */
@@ -1533,15 +1533,21 @@ bozo_process_request(bozo_httpreq_t *req
if (fd < 0) {
debug((httpd, DEBUG_FAT, "open failed: %s", strerror(errno)));
- if (errno == EPERM)
+ switch(errno) {
+ case EPERM:
(void)bozo_http_error(httpd, 403, request,
"no permission to open file");
- else if (errno == ENOENT) {
+ break;
+ case ENAMETOOLONG:
+ /*FALLTHROUGH*/
+ case ENOENT:
if (!bozo_dir_index(request, file, isindex))
(void)bozo_http_error(httpd, 404, request,
"no file");
- } else
+ break;
+ default:
(void)bozo_http_error(httpd, 500, request, "open file");
+ }
goto cleanup_nofd;
}
if (fstat(fd, &sb) < 0) {