This is the mail archive of the
libc-hacker@sourceware.cygnus.com
mailing list for the glibc project.
Re: PR-673
- To: schwab@issan.informatik.uni-dortmund.de (Andreas Schwab)
- Subject: Re: PR-673
- From: hjl@lucon.org (H.J. Lu)
- Date: Mon, 24 Aug 1998 07:49:40 -0700 (PDT)
- Cc: libc-hacker@cygnus.com
>
> 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)
- References:
- PR-673
- From: Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>