From: Nicolas François Date: Mon, 19 Aug 2013 21:43:59 +0000 (+0200) Subject: Do not continue in case of tcsetattr failure. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c89d41d997f38deb801b3cc3bff3f9a44c65090b;p=thirdparty%2Fshadow.git Do not continue in case of tcsetattr failure. * src/su.c: Do not continue in case of tcsetattr failure. --- diff --git a/ChangeLog b/ChangeLog index b149b0e39..39426f29c 100644 --- 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 diff --git a/src/su.c b/src/su.c index 7db5a868b..92b1a536c 100644 --- 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) {