mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-01-08 11:02:24 +01:00
closefrom: Handle lowfd < 0 properly
More important if close_range() is going to be used, since casting negative values to 'unsigned int' might hide the errors. [guillem@hadrons.org: Minor coding style fix. ] Signed-off-by: Guillem Jover <guillem@hadrons.org>
This commit is contained in:
parent
a1f79978e8
commit
c4fca5bb4f
@ -179,6 +179,9 @@ closefrom_procfs(int lowfd)
|
||||
void
|
||||
closefrom(int lowfd)
|
||||
{
|
||||
if (lowfd < 0)
|
||||
lowfd = 0;
|
||||
|
||||
/* Try the fast method first, if possible. */
|
||||
#if defined(HAVE_FCNTL_CLOSEM)
|
||||
if (fcntl(lowfd, F_CLOSEM, 0) != -1)
|
||||
|
Loading…
Reference in New Issue
Block a user