]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Check for failure before setting term in RAW mode.
authorNicolas François <nicolas.francois@centraliens.net>
Mon, 19 Aug 2013 21:26:54 +0000 (23:26 +0200)
committerNicolas François <nicolas.francois@centraliens.net>
Mon, 19 Aug 2013 21:30:09 +0000 (23:30 +0200)
* src/su.c: Do not set terminal in RAW mode in case of earlier
failure.

ChangeLog
src/su.c

index 4bbc9b8e01b4a3b74e864403f2a1691177011e87..b149b0e3946ad4ec0553f775347ebe8c26b1ebcf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
 
        * src/su.c: Fail if the process group leader or the controlling
        terminal cannot be set.
+       * src/su.c: Do not set terminal in RAW mode in case of earlier
+       failure.
 
 2013-08-19  Nicolas François  <nicolas.francois@centraliens.net>
 
index 5c5aec833237877fbc6b8c205ba2660f76c02b5b..122914bda6503079060ff19a7ff31e1978bf0c6d 100644 (file)
--- a/src/su.c
+++ b/src/su.c
@@ -420,7 +420,7 @@ static void handle_session (void)
                }
        }
 
-       if (have_tty == true) {
+       if ((0 == caught) && (have_tty == true)) {
                /* Set RAW mode  */
                termset_new = termset_save;
                cfmakeraw (&termset_new);
@@ -514,8 +514,6 @@ static void handle_session (void)
                                }
                        }
                } while (!stop);
-       }
-
 
        if (have_tty == true) {
                close (fd_pts);
@@ -523,6 +521,7 @@ static void handle_session (void)
                if (tcsetattr (STDIN_FILENO, TCSANOW, &termset_save) == -1)
                        fprintf (stderr, _("%s: Cannot reset termios attributes\n"), Prog);
        }
+       }
 
        if (0 != caught) {
                (void) fputs ("\n", stderr);