Add fcntl F_CLOSEM support to closefrom(); adapted from a diff by

Darren Tucker.
This commit is contained in:
Todd C. Miller
2006-08-17 15:26:54 +00:00
parent 5994797e4d
commit cad6de7d73
4 changed files with 195 additions and 3 deletions

View File

@@ -54,6 +54,14 @@ __unused static const char rcsid[] = "$Sudo$";
/*
* Close all file descriptors greater than or equal to lowfd.
*/
#ifdef HAVE_FCNTL_CLOSEM
void
closefrom(lowfd)
int lowfd;
{
(void) fcntl(lowfd, F_CLOSEM, 0);
}
#else
void
closefrom(lowfd)
int lowfd;
@@ -95,3 +103,4 @@ closefrom(lowfd)
(void) close((int) fd);
}
}
#endif /* !HAVE_FCNTL_CLOSEM */