[CRIU] [PATCH] tty02: open a slave tty with O_NOCTTY
Andrey Vagin
avagin at openvz.org
Fri Nov 2 08:21:05 EDT 2012
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
test/zdtm/live/static/tty02.c | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/test/zdtm/live/static/tty02.c b/test/zdtm/live/static/tty02.c
index 3d73f89..866bd3b 100644
--- a/test/zdtm/live/static/tty02.c
+++ b/test/zdtm/live/static/tty02.c
@@ -5,7 +5,6 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
-#include <signal.h>
#include <sys/wait.h>
#include <termios.h>
#include <sys/ioctl.h>
@@ -13,11 +12,6 @@
const char *test_doc = "Check a non-controling terminal";
const char *test_author = "Andrey Vagin <avagin at openvz.org>";
-static void sighup_handler(int signo)
-{
- test_msg("SIGHUP is here\n");
-}
-
int main(int argc, char ** argv)
{
int fdm, fds;
@@ -26,8 +20,6 @@ int main(int argc, char ** argv)
test_init(argc, argv);
- signal(SIGHUP, sighup_handler);
-
setsid();
fdm = open("/dev/ptmx", O_RDWR);
@@ -41,17 +33,12 @@ int main(int argc, char ** argv)
slavename = ptsname(fdm);
/* set up a controlling terminal */
- fds = open(slavename, O_RDWR);
+ fds = open(slavename, O_RDWR | O_NOCTTY);
if (fds == -1) {
err("Can't open a slave pseudoterminal %s", slavename);
return 1;
}
- if (ioctl(fds, TIOCNOTTY)) {
- err("Unable to detach a terminal");
- return 1;
- }
-
test_daemon();
test_waitsig();
--
1.7.11.7
More information about the CRIU
mailing list