in reply to Re^2: Cleaning up filehandles and directoryhandles
in thread Cleaning up filehandles and directoryhandles

I do know that if you open a filehandle to some device, and then you execute another program (via system, exec, whatever), the filehandle remains open and the new process can use it.

Perl automatically sets the close-on-exec flag (if available on the system) for all descriptors above 2, so exec'd programs should never inherit them. (See $^F in perlvar, F_SETFD in fcntl(2).)

  • Comment on Re^3: Cleaning up filehandles and directoryhandles