On Fri, Apr 22, 2005 at 04:07:48PM -0400, Tom Lane wrote:
>
> Execing some new program is safe enough, although you might wish to
> explicitly close the various sockets the backend holds to make sure
> the new program doesn't maliciously scribble on them.
Is there a way to find out which fds to close, or should a function
just close everything from, say, 3 to <some value> (assuming that
0, 1, and 2 are stdin, stdout, and stderr)? I could think of
non-portable ways like looking under /proc/<pid>/fd, but I was
wondering if the backend keeps track of its fds somewhere.
Thanks.
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/