mirror of
https://github.com/projectatomic/bubblewrap.git
synced 2026-02-05 15:45:22 +01:00
utils: Add fork_intermediate_child() helper
This just forks and exits in the parent, continuing in the child.
This commit is contained in:
13
utils.c
13
utils.c
@@ -80,6 +80,19 @@ die_oom (void)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/* Fork, return in child, exiting the previous parent */
|
||||
void
|
||||
fork_intermediate_child (void)
|
||||
{
|
||||
int pid = fork ();
|
||||
if (pid == -1)
|
||||
die_with_error ("Can't fork for --pidns");
|
||||
|
||||
/* Parent is an process not needed */
|
||||
if (pid != 0)
|
||||
exit (0);
|
||||
}
|
||||
|
||||
void *
|
||||
xmalloc (size_t size)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user