mirror of
https://github.com/troglobit/finit.git
synced 2026-11-09 16:21:24 +00:00
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:
1 parent
70f4d99922
commit
dbcece81ea
1 file changed
+7
-1
@@ -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))
|
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;
|
struct init_request rq;
|
||||||
|
|
||||||
|
sd = accept(w->fd, NULL, NULL);
|
||||||
|
if (sd < 0) {
|
||||||
|
_pe("Failed serving API request");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
|
|||||||
Reference in new issue
Block a user