mirror of
https://github.com/containers/podman
synced 2024-10-22 02:03:38 +00:00
rootless: set controlling terminal for podman in the userns
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
6ddc67c694
commit
531514e823
|
@ -16,6 +16,8 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/prctl.h>
|
||||
#include <dirent.h>
|
||||
#include <termios.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
static const char *_max_user_namespaces = "/proc/sys/user/max_user_namespaces";
|
||||
static const char *_unprivileged_user_namespaces = "/proc/sys/kernel/unprivileged_userns_clone";
|
||||
|
@ -178,6 +180,11 @@ reexec_userns_join (int userns, int mountns)
|
|||
_exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (isatty (1) && ioctl (1, TIOCSCTTY, 0) == -1) {
|
||||
fprintf (stderr, "cannot ioctl(TIOCSCTTY): %s\n", strerror (errno));
|
||||
_exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (setns (userns, 0) < 0)
|
||||
{
|
||||
fprintf (stderr, "cannot setns: %s\n", strerror (errno));
|
||||
|
|
Loading…
Reference in a new issue