delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/10/08/12:50:45

Date: Thu, 8 Oct 1998 12:07:57 -0400 (EDT)
Message-Id: <199810081607.MAA15331@indy.delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: eliz AT is DOT elta DOT co DOT il
CC: djgpp-workers AT delorie DOT com
In-reply-to: <Pine.SUN.3.91.981008184738.2531C-100000@is> (message from Eli
Zaretskii on Thu, 8 Oct 1998 18:59:43 +0300 (IDT))
Subject: Re: Bug in popen
Reply-To: djgpp-workers AT delorie DOT com

> 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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019