Commit 4e868d2d authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Check accept(2) return for failure.

Fixes #668


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4635 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 51fea0fa
......@@ -815,6 +815,8 @@ cmd_http_accept(CMD_ARGS)
TCP_close(&hp->fd);
vtc_log(vl, 4, "Accepting");
hp->fd = accept(hp->sfd, NULL, NULL);
if (hp->fd < 0)
vtc_log(vl, 0, "Accepted failed: %s", strerror(errno));
vtc_log(vl, 3, "Accepted socket fd is %d", hp->fd);
}
......
......@@ -101,7 +101,8 @@ server_thread(void *priv)
addr = (void*)&addr_s;
l = sizeof addr_s;
fd = accept(s->sock, addr, &l);
vtc_log(vl, 3, "Accepted socket fd is %d", fd);
if (fd < 0)
vtc_log(vl, 0, "Accepted failed: %s", strerror(errno));
http_process(vl, s->spec, fd, s->sock);
vtc_log(vl, 3, "shutting fd %d", fd);
assert((shutdown(fd, SHUT_WR) == 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment