This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.


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

Re: PR-673


> 
> I have taken a look at PR-673 and i think this is not a bug in libio.  The
> problem is that a file descriptor is shared via a stdio stream between two
> processes when the child is calling exit().  Then, in _IO_unbuffer_all,
> the stream is made unbuffered, causing the file descriptor to be synced to
> the stream position.  Since the file offset is shared this also affects
> the parent, which however does not know about that, and its stream offset
> becomes unaligned with the underlying file offset.  If you strace the
> _llseek calls you will notice that many of them will fail with EINVAL
> because the effective file position is made negative.
> 
> Now the whole problem disappears if the child does not call exit(), but
> _exit().  I don't know what POSIX says, but i think that calling exit() in
> a child process should be considered invoking undefined behaviour.
> 

Did you mean "calling exit() in a child process without exec should be 
considered invoking undefined behaviour."?

-- 
H.J. Lu (hjl@gnu.org)


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