in reply to Close all open file descriptors

The module Proc::Daemon closes all file handles before it forks. Here's the code snippet from its Init function...
## Close open file descriptors foreach $i (0 .. OpenMax) { POSIX::close($i); }

Replies are listed 'Best First'.
Re^2: Close all open file descriptors
by belg4mit (Prior) on Jul 28, 2004 at 14:47 UTC
    Ewww! Okay so it works, and I have to admit I thought of that general idea too, but iterating over all possible descriptors? That's just inelegant. And POSIX is still so like, heavy, man.

    --
    I'm not belgian but I play one on TV.