From: Nicolas François Date: Mon, 19 Aug 2013 22:35:44 +0000 (+0200) Subject: have_tty and winsz_set are booleans. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d40692dee3339363f49dc108c5eb0038ef723daa;p=thirdparty%2Fshadow.git have_tty and winsz_set are booleans. * src/su.c: have_tty and winsz_set are booleans. --- diff --git a/ChangeLog b/ChangeLog index 9fab5f41a..a07c4fb51 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-08-19 Nicolas François + + * src/su.c: have_tty and winsz_set are booleans. + 2013-08-19 Nicolas François * src/su.c: Fix typos. diff --git a/src/su.c b/src/su.c index e96336f82..a4542df14 100644 --- a/src/su.c +++ b/src/su.c @@ -342,7 +342,7 @@ static void handle_session (void) pid_child = fork (); if (pid_child == 0) { /* child shell */ - if (have_tty == true) { + if (have_tty) { close (fd_ptmx); if (tcsetattr (fd_pts, TCSANOW, &termset_save) == -1) { @@ -351,7 +351,7 @@ static void handle_session (void) exit (1); } - if (winsz_set == true && ioctl (fd_pts, TIOCSWINSZ, &winsz) == -1) + if (winsz_set && ioctl (fd_pts, TIOCSWINSZ, &winsz) == -1) fprintf (stderr, _("%s: Cannot set window size of session %d\n"), Prog, errno); if ( (dup2 (fd_pts, STDIN_FILENO) == -1) @@ -423,7 +423,7 @@ static void handle_session (void) } } - if ((0 == caught) && (have_tty == true)) { + if ((0 == caught) && have_tty) { /* Set RAW mode */ termset_new = termset_save; cfmakeraw (&termset_new); @@ -444,7 +444,7 @@ static void handle_session (void) pid_t pid; stop = true; - if (have_tty == true) + if (have_tty) pid = waitpid (-1, &status, WUNTRACED | WNOHANG); else pid = waitpid (-1, &status, WUNTRACED); @@ -464,7 +464,7 @@ static void handle_session (void) */ kill (pid_child, SIGSTOP); stop = false; - } else if ( ((pid_t)-1 != pid && have_tty == false) + } else if ( ((pid_t)-1 != pid && !have_tty) && (0 != WIFSTOPPED (status))) { /* The child (shell) was suspended. * Suspend su. */ @@ -472,7 +472,7 @@ static void handle_session (void) /* wake child when resumed */ kill (pid, SIGCONT); stop = false; - } else if (pid == (pid_t)0 && have_tty == true) { + } else if (pid == (pid_t)0 && have_tty) { stop = false; if (caught == SIGWINCH) { @@ -525,7 +525,7 @@ static void handle_session (void) } } while (!stop); - if (have_tty == true) { + if (have_tty) { (void) close (fd_pts); /* Reset RAW mode */ if (tcsetattr (STDIN_FILENO, TCSANOW, &termset_save) == -1) {