diff --git a/source3/lib/smbrun.c b/source3/lib/smbrun.c index 3b7ed542ab2..8e3675fdc22 100644 --- a/source3/lib/smbrun.c +++ b/source3/lib/smbrun.c @@ -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);