Re: 12.2: fork() causing getline() to repeat stdin endlessly
> I have a small program (extracted from a big program) which reads and
> prints input lines using a loop of getline() calls. The real input lines
> are all expected to be 52 characters long (+1 for the newline => 53),
> that's what my example data for the small program looks like. If there is
> no fork() in the loop, it works fine. Inside the loop if I do a fork() of
> a child which immediately exits (no exec) and waitpid() for it, then the
> program loops forever repeating the beginning portion of stdin.
>
> I have no idea what package to report the problem against, though it
> doesn't seem to be gcc as I have tried both gcc12 (which comes with debian)
> and gcc13 (which I installed manually).
My crystal ball says the most likely culprits are (in order):
- your code.
- POSIX.
- glibc.
- the kernel.
Stefan
Reply to: