Hi Tobias, On Mon, Jan 13, 2025 at 05:40:43PM +0100, Tobias Stoeckmann wrote: > The _exit function is a better choice for exiting a child in many > cases. Most prominently it avoids calls of functions registered with We use two spaces to separate sentences. See: $ cat CONTRIBUTING.d/patches/description | sed -n '/Style guide/,+6p' Style guide URIs should always be enclosed in <>. The correct inter-sentence space amount is two. See some history about this: <https://web.archive.org/web/20171217060354/http://www.heracliteanriver.com/?p=324> > atexit by the parent. > > There are valid reasons to call exit and the example is actually one > of them: Flush FILE based output. Since atexit is never called, we > could just stay with exit. > > Signed-off-by: Tobias Stoeckmann <tobias@xxxxxxxxxxxxxx> Thanks! I've applied the patch, with some minor tweaks. <https://www.alejandro-colomar.es/src/alx/linux/man-pages/man-pages.git/commit/?h=contrib&id=476bf6d993c13edf8a80c4e874a1d4bf6ff7eb45> > --- > As discussed with alx@ on shadow project, this might still be of > interest to raise awareness of _exit's existence. > --- > man/man2/fork.2 | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/man/man2/fork.2 b/man/man2/fork.2 > index 601391277..b4f7ffde9 100644 > --- a/man/man2/fork.2 > +++ b/man/man2/fork.2 > @@ -326,7 +326,8 @@ main(void) > exit(EXIT_FAILURE); > case 0: > puts("Child exiting."); > - exit(EXIT_SUCCESS); > + fflush(stdout); > + _exit(EXIT_SUCCESS); This mixes tabs and spaces (we use 4 spaces for indentation). I've amended that. Have a lovely night! Alex > default: > printf("Child is PID %jd\[rs]n", (intmax_t) pid); > puts("Parent exiting."); > @@ -339,6 +340,7 @@ main(void) > .BR clone (2), > .BR execve (2), > .BR exit (2), > +.BR _exit (2), > .BR setrlimit (2), > .BR unshare (2), > .BR vfork (2), > -- > 2.48.0 > > -- <https://www.alejandro-colomar.es/>
Attachment:
signature.asc
Description: PGP signature