The patch to add dup2 support was never updated to handle the fd
state. The check for the fd type == fd_fork is no longer valid.
We need to instead check the fd state before handling forking.
Problem pointed out by Alex Couvrard <acouvrard@gmail.com>
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
init_preload();
oldfdi = idm_lookup(&idm, oldfd);
- if (oldfdi && oldfdi->type == fd_fork)
- fork_passive(oldfd);
+ if (oldfdi) {
+ if (oldfdi->state == fd_fork_passive)
+ fork_passive(oldfd);
+ else if (oldfdi->state == fd_fork_active)
+ fork_active(oldfd);
+ }
newfdi = idm_lookup(&idm, newfd);
if (newfdi) {