From 0a085a83576911f849c718e0e7a3d6d4865145d6 Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Thu, 21 Sep 2006 19:42:31 +0000 Subject: [PATCH] Add the reset atexit handler right after setting the terminal to raw mode, so we don't end up with a raw terminal if (e.g.) openpty fails. git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2325 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- src/vlogin.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vlogin.c b/src/vlogin.c index 56a1df0..70a8aed 100644 --- a/src/vlogin.c +++ b/src/vlogin.c @@ -209,6 +209,9 @@ void do_vlogin(int argc, char *argv[], int ind) /* set terminal to raw mode */ terminal_raw(); + /* reset terminal to its original mode */ + atexit(terminal_reset); + /* fork new pseudo terminal */ if (openpty(&t.fd, &slave, NULL, NULL, NULL) == -1) { perror(ENSC_WRAPPERS_PREFIX "openpty()"); @@ -254,9 +257,6 @@ void do_vlogin(int argc, char *argv[], int ind) strncpy(argv[0], "login", n); - /* reset terminal to its original mode */ - atexit(terminal_reset); - /* we want a redraw */ terminal_redraw(); -- 1.8.1.5