This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libiberty/pex-unix vfork abuse?


"Dave Korn" <dave.korn@artimi.com> writes:

>   Note the several calls to dup2() and close(), which seem to me to be "calls
> [to] any other function", and the setting of environ, which seem to me to be
> modification of "any data other than a variable of type pid_t used to store
> the return value from vfork()".

Despite the standardese, vfork was invented to support calling
dup/dup2 before calling exec.  Without that feature, it would be
nearly useless.  Any actual implementation of vfork must support
calling dup/dup2, or it will break all real programs which use vfork.

On the other hand, the setting of environ is very dubious and is
likely to break on real systems.  The code should be changed to call
execve instead.  Unfortunately there is no standard execvpe function.
Fortunately gcc never uses the variant which sets environ.  Offhand
I'm not sure what does.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]