Timo Sirainen wrote: > On Sun, 2007-09-30 at 09:30 +0200, Lars Stavholm wrote: >> Another (mildly stupid maybe) question: why the fork() >> in the original dspam plugin? Seems to me that the fork() >> + waitpid() doesn't really allow for any advantage over >> a simple popen() and read the output? I have a sneaky >> feeling that I'm missing something vital here. > > popen() uses FILE streams, which I at least try to avoid. For example in > some systems (Solaris IIRC) they were limited to 256 first file > descriptors. > > It also executes everything through /bin/sh -c, which is pointless if > you're not running a script and possibly dangerous if you're not > escaping parameters correctly.
I hear you. What would you suggest instead? pipe() + fork() + execl()? /L