diff options
author | Todd C. Miller <Todd.Miller@sudo.ws> | 2022-06-07 09:25:07 -0600 |
---|---|---|
committer | Todd C. Miller <Todd.Miller@sudo.ws> | 2022-06-07 09:25:07 -0600 |
commit | 1fa397dd5d2e8ed0be0e2c0fe372f5eefd680f52 (patch) | |
tree | 5a63222e332628e55cf7e2e99a375c507ffadfcc /logsrvd/logsrvd.c | |
parent | 2ebb3cd1d8790ddf764cebff43030538f6c507cb (diff) | |
download | sudo-1fa397dd5d2e8ed0be0e2c0fe372f5eefd680f52.tar.gz |
Treat EINTR in a callback like we do EAGAIN.
We shouldn't get EINTR in practice since we set SA_RESTART when
registering signal handlers but it doesn't hurt to be consistent.
Diffstat (limited to 'logsrvd/logsrvd.c')
-rw-r--r-- | logsrvd/logsrvd.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/logsrvd/logsrvd.c b/logsrvd/logsrvd.c index 23d85b410..4bf739ff5 100644 --- a/logsrvd/logsrvd.c +++ b/logsrvd/logsrvd.c @@ -929,7 +929,7 @@ server_msg_cb(int fd, int what, void *v) } if (nwritten == -1) { - if (errno == EAGAIN) + if (errno == EAGAIN || errno == EINTR) debug_return; sudo_warn("%s: write", closure->ipaddr); goto finished; @@ -1045,7 +1045,7 @@ client_msg_cb(int fd, int what, void *v) __func__, nread, closure->ipaddr); switch (nread) { case -1: - if (errno == EAGAIN) + if (errno == EAGAIN || errno == EINTR) debug_return; sudo_warn("%s: read", closure->ipaddr); goto close_connection; @@ -1521,9 +1521,10 @@ listener_cb(int fd, int what, void *v) "unable to start new connection"); } } else { - if (errno != EAGAIN) - sudo_warn("accept"); + if (errno == EAGAIN || errno == EINTR) + debug_return; /* TODO: pause accepting on ENFILE and EMFILE */ + sudo_warn("accept"); } debug_return; |