diff options
author | Darell Tan <darell.tan@gmail.com> | 2011-01-02 22:00:42 +0800 |
---|---|---|
committer | Darell Tan <darell.tan@gmail.com> | 2011-01-02 22:00:42 +0800 |
commit | afe9bad84fb42082a340314db0fe51eb637b662e (patch) | |
tree | fcdf8ab74debf1a8d827dc9515cdfc1d8fdc0280 | |
parent | 90b65fa827f95fa93446e604a449be05e64ae2b5 (diff) | |
download | mdns-repeater-afe9bad84fb42082a340314db0fe51eb637b662e.tar.gz mdns-repeater-afe9bad84fb42082a340314db0fe51eb637b662e.zip |
Bugfix: handled condition where select() call was interrupted by SIGTERM and doesn't shutdown.
-rw-r--r-- | mdns-repeater.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mdns-repeater.c b/mdns-repeater.c index af17dca..bc00bac 100644 --- a/mdns-repeater.c +++ b/mdns-repeater.c @@ -324,7 +324,7 @@ int main(int argc, char *argv[]) { FD_ZERO(&sockfd_set); FD_SET(server_sockfd, &sockfd_set); int numfd = select(server_sockfd + 1, &sockfd_set, NULL, NULL, &tv); - if (numfd == 0) + if (numfd <= 0) continue; if (FD_ISSET(server_sockfd, &sockfd_set)) { @@ -385,5 +385,7 @@ int main(int argc, char *argv[]) { for (i = 0; i < num_socks; i++) close(socks[i].sockfd); + log_message(LOG_INFO, "exit."); + return 0; } |