Fix Coverty CID #96210: Argument cannot be negative.

We must check the return value from `accept()`, it may fail.  Also, we
should probably retry the syscall in some cases ...

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2015-06-17 13:36:06 +02:00
parent 70f4d99922
commit dbcece81ea
+7 -1
View File
@@ -126,9 +126,15 @@ static int do_query_inetd(char *buf, size_t len)
static void cb(uev_t *w, void *UNUSED(arg), int UNUSED(events))
{
int sd = accept(w->fd, NULL, NULL);
int sd;
struct init_request rq;
sd = accept(w->fd, NULL, NULL);
if (sd < 0) {
_pe("Failed serving API request");
return;
}
while (1) {
int result = 0;
ssize_t len;