https://stackoverflow.com/questions/5422831/what-is-the-difference-between-using-exit-exit-in-a-conventional-linux-fo

Are every single one of these people incorrect?
-Luke


On Tue, Oct 27, 2020 at 3:25 PM Philip Guenther <[email protected]>
wrote:

> On Tue, 27 Oct 2020, Luke Small wrote:
> > I have a C program which fork()s and the child process unlink()s
> > /etc/installurl, opens /etc/installurl and writes to it. I _exit(0); and
> > I've tested it where the parent returns or exit()s and unless I
> > specifically call fclose() after the fwrite(), the processes will close
> > without actually writing to the file.
> >
> > Is this correct functionality? It seems like it ought to not need to have
> > an fclose() or even an fflush().
>
> Yes, it's correct.  Call exit(3), not _exit(2) in the child when you want
> the functionality of exit(3), such as flushing stdio buffers.
>
> You should follow up with whatever documentation that suggested you should
> call _exit(2) in the child, so that it can be corrected.
>
>
> Philip Guenther
>

Reply via email to