summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2017-07-30 23:25:11 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2017-07-30 23:28:07 -0400
commit6def094c235f45e3f14daf91195f856dc3f074ff (patch)
treed9ff2fae214de910258daddc83ea127a1c1156b8
parentc5865d4f0b7c46d4057de44c47b709e14ce27640 (diff)
downloadlighttpd1.4-6def094c235f45e3f14daf91195f856dc3f074ff.tar.gz
lighttpd1.4-6def094c235f45e3f14daf91195f856dc3f074ff.zip
[core] fix invalid sizeof() identified by coverity
and quiet other coverity warnings
-rw-r--r--src/inet_ntop_cache.c2
-rw-r--r--src/server.c6
2 files changed, 6 insertions, 2 deletions
diff --git a/src/inet_ntop_cache.c b/src/inet_ntop_cache.c
index 53665e8b..68a60cf7 100644
--- a/src/inet_ntop_cache.c
+++ b/src/inet_ntop_cache.c
@@ -126,7 +126,7 @@ int sock_addr_nameinfo_append_buffer(server *srv, buffer *b, const sock_addr *ad
else if (AF_INET6 == addr->plain.sa_family) {
char hbuf[256];
if (0 != getnameinfo((const struct sockaddr *)(&addr->ipv6),
- sizeof(&addr->ipv6),
+ sizeof(addr->ipv6),
hbuf, sizeof(hbuf), NULL, 0, 0)) {
log_error_write(srv, __FILE__, __LINE__,
"SSS", "NOTICE: getnameinfo failed: ",
diff --git a/src/server.c b/src/server.c
index 68892eed..639859c7 100644
--- a/src/server.c
+++ b/src/server.c
@@ -517,7 +517,10 @@ static int server_oneshot_init(server *srv, int fd) {
}
/*(must set flags; fd did not pass through fdevent accept() logic)*/
- fdevent_fcntl_set_nb_cloexec(srv->ev, fd);
+ if (-1 == fdevent_fcntl_set_nb_cloexec(srv->ev, fd)) {
+ log_error_write(srv, __FILE__, __LINE__, "ss", "fcntl:", strerror(errno));
+ return 0;
+ }
if (cnt_addr.plain.sa_family != AF_UNIX) {
network_accept_tcp_nagle_disable(fd);
@@ -1167,6 +1170,7 @@ static int server_main (server * const srv, int argc, char **argv) {
int devnull;
int errfd;
do {
+ /* coverity[resource_leak : FALSE] */
devnull = fdevent_open_devnull();
} while (-1 != devnull && devnull <= STDERR_FILENO);
if (-1 == devnull) {