s3:winbind: Check return code of set_blocking()
authorAndreas Schneider <asn@samba.org>
Tue, 24 Nov 2020 16:33:26 +0000 (17:33 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 26 Nov 2020 06:52:41 +0000 (06:52 +0000)
Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/winbindd/winbindd_dual.c

index 3d8a567a6e48c66f2d4d526a2c213fb63dd099ba..c489913766595075c44d169aa00db67975ad1dfd 100644 (file)
@@ -1684,6 +1684,7 @@ static bool fork_domain_child(struct winbindd_child *child)
        if (child->pid != 0) {
                /* Parent */
                ssize_t nread;
+               int rc;
 
                close(fdpair[0]);
 
@@ -1714,9 +1715,15 @@ static bool fork_domain_child(struct winbindd_child *child)
                        return false;
                }
 
+               rc = set_blocking(fdpair[1], false);
+               if (rc < 0) {
+                       close(fdpair[1]);
+                       return false;
+               }
+
                child->sock = fdpair[1];
-               set_blocking(child->sock, false);
-               return True;
+
+               return true;
        }
 
        /* Child */