|
From: Christoph P. <cp...@ch...> - 2003-02-10 10:06:09
|
Aaron Sethman wrote: > Here is a simple little replacement for system() that does close file > descriptors. The main issue with it is though, it ends up picking an > arbitrary number of fds to close. I picked closing 0 to 99. I don't think this is necessary. Every file descriptor has a "close on exec" flag that you can set with fcntl(). Then, you can use plain system(). It should work like this: fcntl(fd, F_SETFD, FD_CLOEXEC); Ideally, one would do this for each file descriptor as it is opened. Hope this helps, chrisp -- chrisp a.k.a. Christoph Pfisterer "A computer scientist is cp...@ch... - http://chrisp.de someone who fixes things PGP key & geek code available that aren't broken." |