Commit a943071e authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

tty02: open a slave tty with O_NOCTTY

Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent e6bd3258
......@@ -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@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();
......
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