Mail Archives: djgpp-workers/1998/10/08/12:50:45
> I think this is a bug. Man pages on all Unix boxes that I could access
> explicitly say that failure to fork causes NULL to be returned. DJ, is
> that what Posix says as well?
POSIX assumes you're using a command interpreter to run the programs,
which we usually don't do. In the case where the command interpreter
fails to run the given program, pclose() should return an error.
popen() returns an error if the pipe cannot be created or the fork
fails; other errors are deferred until pclose(). We don't fork(),
so how could we return that error?
However, the exact wording is "The popen() function shall return a
NULL pointer if the pipe or subprocess cannot be created. Otherwise,
it shall return a stream pointer as described above." This could
be interpreted as letting our popen() return NULL if the program
to run doesn't exist.
- Raw text -