]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib: Use closefrom() in smbrun.c
authorVolker Lendecke <vl@samba.org>
Wed, 8 Jan 2020 15:07:30 +0000 (16:07 +0100)
committerJeremy Allison <jra@samba.org>
Sun, 19 Jan 2020 18:29:39 +0000 (18:29 +0000)
INSURE is never defined or used.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/smbrun.c

index 3b7ed542ab2bca19f6318861b07e6dac78e96b99..8e3675fdc221e92e73bba0a8d5458aa23adbcd20 100644 (file)
@@ -181,14 +181,9 @@ static int smbrun_internal(const char *cmd, int *outfd, bool sanitize,
                }
        }
 
-#ifndef __INSURE__
        /* close all other file descriptors, leaving only 0, 1 and 2. 0 and
           2 point to /dev/null from the startup code */
-       {
-       int fd;
-       for (fd=3;fd<256;fd++) close(fd);
-       }
-#endif
+       closefrom(3);
 
        {
                char *newcmd = NULL;
@@ -347,14 +342,9 @@ int smbrunsecret(const char *cmd, const char *secret)
                }
        }
 
-#ifndef __INSURE__
        /* close all other file descriptors, leaving only 0, 1 and 2. 0 and
           2 point to /dev/null from the startup code */
-       {
-               int fd;
-               for (fd = 3; fd < 256; fd++) close(fd);
-       }
-#endif
+       closefrom(3);
 
        execl("/bin/sh", "sh", "-c", cmd, NULL);