Re: 12.2: fork() causing getline() to repeat stdin endlessly
Greg Wooledge writes:
> On Tue, Oct 24, 2023 at 11:01:55PM +0700, Max Nikulin wrote:
>
> At this point, we can conclude that the bug is in fact in the OP's C
> program. The underlying C compiler, C library, and Linux kernel are
> all behaving within specs.
>
> At this point I still don't know *why* glibc rewinds stdin intermittently
> on exit(). Apparently Mac OS X doesn't, or at least didn't at the time
> the answer was written (2018). I guess there must be some reason for it,
> and it's not just randomly pranking people, even if I don't understand
> the reason.
>
> This has been a most educational thread.
Hi Greg.
Yes, Greg, indeed!
I have been fighting a similar problem in fork(2). The program was
written in the 1990's, and recompiled in 2006 for amd64. The program
ran 24/7 for 17 years, until several months ago, when the file was
erratically truncated to zero bytes, every few days.
Does anyone know if there are any recent changes to gcc/libraries for
fork(2) and/or system(3)?
Be safe,
John
--
John Conover, conover@panix.com, http://www.johncon.com/
Reply to: