close_range will clamp the range between [0, fdp->fd_lastfile], but failed to take into account that fdp->fd_lastfile can become -1 if all fds are closed. =-( In this scenario, just return because there's nothing further we can do at the moment. Add a test case for this, fork() and simply closefrom(0) twice in the child; on the second invocation, fdp->fd_lastfile == -1 and will trigger a panic before this change. X-MFC-With: r359836 |
||
---|---|---|
.. | ||
closefrom_test.c | ||
dup_test.c | ||
fcntlflags_test.c | ||
flock_helper.c | ||
flock_test.sh | ||
ftruncate_test.c | ||
Makefile | ||
Makefile.depend | ||
newfileops_on_fork_test.c |