summaryrefslogtreecommitdiff
path: root/usr.sbin/httpd
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2024-02-13 14:00:25 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2024-02-13 14:00:25 +0000
commitc009070a26fd225e0fef80aa218bc758d1cf5446 (patch)
tree6ecd12fe03dba2a876da1bdbb27fe2f59e96c46c /usr.sbin/httpd
parent3bf939b5dc77522812f021796d66a014be458f59 (diff)
Stop logging misleading errors when custom generic error pages are in use.
Only call the open(2) log_warn for errnos that are not ENOENT. Since that is an error worth logging. Based on a diff from Carsten Reith (carsten.reith t-online.de) OK florian@ deraadt@
Diffstat (limited to 'usr.sbin/httpd')
-rw-r--r--usr.sbin/httpd/server_http.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.sbin/httpd/server_http.c b/usr.sbin/httpd/server_http.c
index 08deda7d5f0..0a814e7a656 100644
--- a/usr.sbin/httpd/server_http.c
+++ b/usr.sbin/httpd/server_http.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server_http.c,v 1.153 2022/09/21 05:55:18 yasuoka Exp $ */
+/* $OpenBSD: server_http.c,v 1.154 2024/02/13 14:00:24 claudio Exp $ */
/*
* Copyright (c) 2020 Matthias Pressfreund <mpfr@fn.de>
@@ -1762,13 +1762,14 @@ read_errdoc(const char *root, const char *file)
struct stat sb;
char *path;
int fd;
- char *ret = NULL;
+ char *ret;
if (asprintf(&path, "%s/%s.html", root, file) == -1)
fatal("asprintf");
if ((fd = open(path, O_RDONLY)) == -1) {
free(path);
- log_warn("%s: open", __func__);
+ if (errno != ENOENT)
+ log_warn("%s: open", __func__);
return (NULL);
}
free(path);
@@ -1788,8 +1789,7 @@ read_errdoc(const char *root, const char *file)
log_warn("%s: read", __func__);
close(fd);
free(ret);
- ret = NULL;
- return (ret);
+ return (NULL);
}
close(fd);