diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2020-09-10 09:34:51 +0200 |
---|---|---|
committer | Tobias Klauser <tobias.klauser@gmail.com> | 2020-09-10 11:51:55 +0200 |
commit | a06a6349436ccddb2909715f495b53fe9a0f8969 (patch) | |
tree | fc0b97ae7abef0d5d040db890d8c170ecc649c3c /llmnrd.c | |
parent | 3cfccf9d9e89861dbad3e5dc169b6db9356140ad (diff) |
llmnrd: exit gracefully on select() EINTR
If a signal was caught, select returns with errno set to EINTR. The
signal handler already set llmnrd_running = false.
This will also make sure the log message moved by commit a1a821814101
("llmnrd: only async signal safe functions may be called in signal
handler") will get logged correctly in all cases and the process will
exit gracefully.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'llmnrd.c')
-rw-r--r-- | llmnrd.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -262,9 +262,10 @@ int main(int argc, char **argv) ret = select(nfds, &rfds, NULL, &efds, NULL); if (ret < 0) { - if (errno != EINTR) + if (errno != EINTR) { log_err("Failed to select() on socket: %s\n", strerror(errno)); - goto out; + goto out; + } } else if (ret) { /* handle RTNL messages first so we can respond with * up-to-date information. |