From 178f0b8c4d4b0106817fe291aafb513175928288 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Mon, 3 Feb 2014 16:51:25 +0100 Subject: [PATCH] minissdpd.c: silently ignore EAGAIN, EWOULDBLOCK, EINTR of recv calls --- minissdpd/Changelog.txt | 5 ++++- minissdpd/minissdpd.c | 11 +++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/minissdpd/Changelog.txt b/minissdpd/Changelog.txt index fa17abd..54cd416 100644 --- a/minissdpd/Changelog.txt +++ b/minissdpd/Changelog.txt @@ -1,4 +1,7 @@ -$Id: Changelog.txt,v 1.32 2013/08/19 16:40:55 nanard Exp $ +$Id: Changelog.txt,v 1.33 2014/02/03 15:45:07 nanard Exp $ + +2014/02/03: + silently ignore EAGAIN, EWOULDBLOCK, EINTR of recv calls 2013/08/19: Translate README in english diff --git a/minissdpd/minissdpd.c b/minissdpd/minissdpd.c index 25bacb3..9b6d63b 100644 --- a/minissdpd/minissdpd.c +++ b/minissdpd/minissdpd.c @@ -224,6 +224,7 @@ SendSSDPMSEARCHResponse(int s, const struct sockaddr * sockname, n = sendto(s, buf, l, 0, sockname, sockname_len ); if(n < 0) { + /* XXX handle EINTR, EAGAIN, EWOULDBLOCK */ syslog(LOG_ERR, "sendto(udp): %m"); } } @@ -1002,7 +1003,10 @@ int main(int argc, char * * argv) (struct sockaddr *)&sendername6, &sendername6_len); if(n<0) { - syslog(LOG_ERR, "recvfrom: %m"); + /* EAGAIN, EWOULDBLOCK, EINTR : silently ignore (try again next time) + * other errors : log to LOG_ERR */ + if(errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR) + syslog(LOG_ERR, "recvfrom: %m"); } else { @@ -1033,7 +1037,10 @@ int main(int argc, char * * argv) (struct sockaddr *)&sendername, &sendername_len); if(n<0) { - syslog(LOG_ERR, "recvfrom: %m"); + /* EAGAIN, EWOULDBLOCK, EINTR : silently ignore (try again next time) + * other errors : log to LOG_ERR */ + if(errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR) + syslog(LOG_ERR, "recvfrom: %m"); } else {