]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
snmp: preserve previous flags when making AgentX socket non-blocking
authorVincent Bernat <vincent@bernat.im>
Tue, 8 Jul 2014 19:56:36 +0000 (21:56 +0200)
committerVincent Bernat <vincent@bernat.im>
Tue, 8 Jul 2014 19:56:36 +0000 (21:56 +0200)
src/daemon/priv.c

index 187d90d970f14f3d996a50263eb0c9e7cb52656d..a8ac50da80398efb094cd7a6e5171c800706651c 100644 (file)
@@ -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));