Don't close fd if it's lower then stderr, otherwise we can close

one of the descriptor which we just set.

Pointed out by:		jilles
Approved by:		re (hrs)
This commit is contained in:
Mariusz Zaborski 2016-06-13 00:03:55 +00:00
parent 74bc093c1c
commit 59cf368df4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=301844

View File

@ -360,7 +360,8 @@ stdnull(void)
if (dup2(fd, STDERR_FILENO) == -1)
errx(1, "Unable to cover stderr");
close(fd);
if (fd > STDERR_FILENO)
close(fd);
}
static void