From: Vincent Bernat Date: Tue, 8 Jul 2014 19:56:36 +0000 (+0200) Subject: snmp: preserve previous flags when making AgentX socket non-blocking X-Git-Tag: 0.7.10~25 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dc6436adb4db0ed9008de2f4eb80812102e87209;p=thirdparty%2Flldpd.git snmp: preserve previous flags when making AgentX socket non-blocking --- diff --git a/src/daemon/priv.c b/src/daemon/priv.c index 187d90d9..a8ac50da 100644 --- a/src/daemon/priv.c +++ b/src/daemon/priv.c @@ -355,7 +355,9 @@ asroot_snmp_socket() return; } - if (fcntl(sock, F_SETFL, O_NONBLOCK) < 0) { + int flags; + if ((flags = fcntl(sock, F_GETFL, NULL)) < 0 || + fcntl(sock, F_SETFL, flags | O_NONBLOCK) < 0) { log_warn("privsep", "cannot set sock %s to non-block : %s", addr->sun_path, strerror(errno));