]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Do not continue in case of tcsetattr failure.
authorNicolas François <nicolas.francois@centraliens.net>
Mon, 19 Aug 2013 21:43:59 +0000 (23:43 +0200)
committerNicolas François <nicolas.francois@centraliens.net>
Mon, 19 Aug 2013 21:43:59 +0000 (23:43 +0200)
* src/su.c: Do not continue in case of tcsetattr failure.

ChangeLog
src/su.c

index b149b0e3946ad4ec0553f775347ebe8c26b1ebcf..39426f29c3931008b77bff9844c510e4bd80f503 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
        terminal cannot be set.
        * src/su.c: Do not set terminal in RAW mode in case of earlier
        failure.
+       * src/su.c: Do not continue in case of tcsetattr failure.
 
 2013-08-19  Nicolas François  <nicolas.francois@centraliens.net>
 
index 7db5a868bc3a05b9022bd4bf24081a97634677f0..92b1a536c913a69ee8057a798a7239218638a1b1 100644 (file)
--- a/src/su.c
+++ b/src/su.c
@@ -424,7 +424,14 @@ static void handle_session (void)
                /* Set RAW mode  */
                termset_new = termset_save;
                cfmakeraw (&termset_new);
-               tcsetattr (STDIN_FILENO, TCSANOW, &termset_new);
+               if (tcsetattr (STDIN_FILENO, TCSANOW, &termset_new) != 0) {
+                       /* FIXME: At least one change was successful. 
+                        * Success should be checked with tcsetattr */
+                       fprintf (stderr,
+                                _("%s: Cannot set terminal attributes: %s\n"),
+                                Prog, strerror (errno));
+                       caught = -1;
+               }
        }
 
        if (0 == caught) {