diff options
| author | shm <shm@NetBSD.org> | 2014-07-02 13:58:09 +0000 |
|---|---|---|
| committer | shm <shm@NetBSD.org> | 2014-07-02 13:58:09 +0000 |
| commit | 6fa9ca406cf947f0fdb156fe80f38aaacf862a05 (patch) | |
| tree | 3abfd3449d75b054c7aba5156c109448831e376b /libexec/httpd | |
| parent | 7b8d5d2e6f1aedf7fde252da2276c3e5db26cd6a (diff) | |
Handle ENAMETOOLONG to return 404 error instead of 500.
OK mrg@
Diffstat (limited to 'libexec/httpd')
| -rw-r--r-- | libexec/httpd/bozohttpd.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libexec/httpd/bozohttpd.c b/libexec/httpd/bozohttpd.c index 6d70ce3806a..7b288126228 100644 --- a/libexec/httpd/bozohttpd.c +++ b/libexec/httpd/bozohttpd.c @@ -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 *request) 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) { |
