From: Daniel Hokka Zakrisson Date: Thu, 21 Sep 2006 19:42:31 +0000 (+0000) Subject: Add the reset atexit handler right after setting the terminal to raw mode, so we... X-Git-Tag: release-0.30.211~30 X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0a085a83576911f849c718e0e7a3d6d4865145d6;p=util-vserver.git 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 --- 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();