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:
oshogbo 2016-06-13 00:03:55 +00:00
parent 9cb15c34bc
commit 891559e499

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