in reply to Re^2: Leaking a file descriptor into a child to use with /proc/self/fd/3
in thread Leaking a file descriptor into a child to use with /proc/self/fd/3
This worked:
open(my $in, '/etc/passwd'); my $flags = fcntl($in, F_GETFD, 0); fcntl($in, F_SETFD, $flags & (~FD_CLOEXEC)) or die "Can't set flags: $ +!\n"; if (!fork()) { exec("grep", "root", "/proc/self/fd/" . fileno($in)); } close($in);
|
|---|