Skip to content

Commit

Permalink
Merge pull request #267 from giuseppe/always-setsid
Browse files Browse the repository at this point in the history
libcrun: always use setsid
  • Loading branch information
giuseppe committed Feb 13, 2020
2 parents bbb1fa9 + 2c681f8 commit 474b927
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/libcrun/container.c
Original file line number Diff line number Diff line change
Expand Up @@ -680,14 +680,14 @@ container_init_setup (void *args, const char *notify_socket,
}
}

ret = setsid ();
if (UNLIKELY (ret < 0))
return crun_make_error (err, errno, "setsid");

if (has_terminal)
{
cleanup_close int terminal_fd = -1;

ret = setsid ();
if (UNLIKELY (ret < 0))
return crun_make_error (err, errno, "setsid");

fflush (stderr);

terminal_fd = libcrun_set_terminal (container, err);
Expand Down
6 changes: 0 additions & 6 deletions src/libcrun/linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -2916,12 +2916,6 @@ libcrun_join_process (libcrun_container_t *container, pid_t pid_to_join, libcrun
for (i = 0; all_namespaces[i]; i++)
close_and_reset (&fds[i]);

if (detach && setsid () < 0)
{
crun_make_error (err, errno, "setsid");
goto exit;
}

/* We need to fork once again to join the PID namespace. */
pid = fork ();
if (UNLIKELY (pid < 0))
Expand Down

0 comments on commit 474b927

Please sign in to comment.