Commit c4fca5bb authored by cptpcrd's avatar cptpcrd Committed by Guillem Jover

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's avatarGuillem Jover <guillem@hadrons.org>
parent a1f79978
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment