Commit 50864274 authored by Andrei Vagin's avatar Andrei Vagin

zdtm: check a case when a slave pty is mounted to somewhere

travis-ci: success for A few fixes to c/r a docker container with a console (rev3)
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent aa26237e
...@@ -114,6 +114,7 @@ TST_NOFILE := \ ...@@ -114,6 +114,7 @@ TST_NOFILE := \
rlimits00 \ rlimits00 \
pty00 \ pty00 \
pty01 \ pty01 \
pty-console \
pty02 \ pty02 \
pty03 \ pty03 \
pty04 \ pty04 \
...@@ -452,6 +453,8 @@ socket-tcp6-last-ack: override CFLAGS += -D ZDTM_TCP_LAST_ACK -D ZDTM_IPV6 ...@@ -452,6 +453,8 @@ socket-tcp6-last-ack: override CFLAGS += -D ZDTM_TCP_LAST_ACK -D ZDTM_IPV6
socket-tcp6-closing: override CFLAGS += -D ZDTM_IPV6 socket-tcp6-closing: override CFLAGS += -D ZDTM_IPV6
socket-tcp6-unconn: override CFLAGS += -D ZDTM_IPV6 socket-tcp6-unconn: override CFLAGS += -D ZDTM_IPV6
pty-console: override CFLAGS += -D ZDTM_DEV_CONSOLE
$(LIB): force $(LIB): force
$(Q) $(MAKE) -C $(LIBDIR) $(Q) $(MAKE) -C $(LIBDIR)
......
pty01.c
\ No newline at end of file
{'flags': 'suid', 'flavor' : 'ns uns'}
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <string.h> #include <string.h>
#include <termios.h> #include <termios.h>
#include <signal.h> #include <signal.h>
#include <sys/mount.h>
#include "zdtmtst.h" #include "zdtmtst.h"
...@@ -51,6 +52,19 @@ int main(int argc, char *argv[]) ...@@ -51,6 +52,19 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
#ifdef ZDTM_DEV_CONSOLE
{
int fd;
fd = open("/dev/console", O_CREAT | O_RDONLY, 0755);
if (fd < 0)
return -1;
close(fd);
if (mount(slavename, "/dev/console", NULL, MS_BIND, NULL))
return -1;
}
#endif
if (fchown(slave1, new_uid, new_gid)) { if (fchown(slave1, new_uid, new_gid)) {
pr_perror("Can't set uid/gid on %s", slavename); pr_perror("Can't set uid/gid on %s", slavename);
return 1; return 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment