From: Volker Lendecke Date: Wed, 8 Jan 2020 15:07:30 +0000 (+0100) Subject: lib: Use closefrom() in smbrun.c X-Git-Tag: samba-4.12.0rc1~69 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=25bcf0e7890a690f5f573dc5e8392807c403948c;p=thirdparty%2Fsamba.git lib: Use closefrom() in smbrun.c INSURE is never defined or used. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- 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);