Skip to content

Commit

Permalink
REBASE fix code grammar in fork_func()
Browse files Browse the repository at this point in the history
  • Loading branch information
gperciva committed Aug 27, 2023
1 parent 488adf0 commit ece2651
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions util/fork_func.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,18 @@ fork_func(int (* func)(void *), void * cookie)
pid_t pid;

/* Fork */
if ((pid = fork()) == -1) {
switch (pid = fork()) {
case -1:
warnp("fork");
goto err0;
}
if (pid == 0) {
case 0:
/* In child process: Run the provided function, then exit. */
_exit((*func)(cookie));
default:
/* In parent process: do nothing else. */
break;
}

/* In parent process: do nothing else. */

/* Success! */
return (pid);

Expand Down Expand Up @@ -68,7 +69,7 @@ fork_func_wait(pid_t pid)
warn0("pid %jd: stopped with %i",
(intmax_t)pid, WSTOPSIG(status));
else
warn0("pid %jd: stopped for unknown reason.");
warn0("pid %jd: exited for unknown reason.");
}

err0:
Expand Down

0 comments on commit ece2651

Please sign in to comment.