from man _exit:
All open file descriptors in the calling process are closed. This
may entail delays; for example, *waiting for output to drain*. A
process in this state may not be killed, as it is already dying.
-Luke
On Tue, Oct 27, 2020 at 4:00 PM Luke Small <[email protected]> wrote:
>
> 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
>>
>