]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Add brackets and parenthesis.
authorNicolas François <nicolas.francois@centraliens.net>
Mon, 19 Aug 2013 22:44:09 +0000 (00:44 +0200)
committerNicolas François <nicolas.francois@centraliens.net>
Mon, 19 Aug 2013 23:43:47 +0000 (01:43 +0200)
* src/su.c: Add brackets and parenthesis.

ChangeLog
src/su.c

index 9d5dd4cd1a1b8c634c3cf26371d9fb31ff39cc01..81156442292a2591727c89125fb0acf138736950 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2013-08-19  Nicolas François  <nicolas.francois@centraliens.net>
 
        * src/su.c: Avoid multiple statements per line.
+       * src/su.c: Add brackets and parenthesis.
 
 2013-08-19  Nicolas François  <nicolas.francois@centraliens.net>
 
index 7be5f45852c27a2aef0e855229677f5556842e68..dcd9b06ac2e472e83296cf42b0d1dba603d3c958 100644 (file)
--- a/src/su.c
+++ b/src/su.c
@@ -300,11 +300,12 @@ static void handle_session (void)
                        exit (1);
                }
 
-               if (ioctl (STDIN_FILENO, TIOCGWINSZ, &winsz) == -1 )
+               if (ioctl (STDIN_FILENO, TIOCGWINSZ, &winsz) == -1 ) {
                        fprintf (stderr, _("%s: Cannot get window size\n"), Prog);
-               else
+               } else {
                        winsz_set = true;
-               
+               }
+
                /*
                 * Open and prepare pseudo terminal master
                 */
@@ -354,8 +355,10 @@ static void handle_session (void)
                                exit (1);
                        }
 
-                       if (winsz_set && 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)
                            || (dup2 (fd_pts, STDOUT_FILENO) == -1)
@@ -366,9 +369,11 @@ static void handle_session (void)
                                exit (1);
                        }
 
-                       if (STDIN_FILENO != fd_pts && STDOUT_FILENO != fd_pts
-                                       && STDERR_FILENO != fd_pts)
+                       if (   (STDIN_FILENO  != fd_pts)
+                           && (STDOUT_FILENO != fd_pts)
+                           && (STDERR_FILENO != fd_pts)) {
                                close (fd_pts);
+                       }
 
                        if (setsid() == -1) {
                                fprintf (stderr,
@@ -447,10 +452,11 @@ static void handle_session (void)
                        pid_t pid;
                        stop = true;
 
-                       if (have_tty)
+                       if (have_tty) {
                                pid = waitpid (-1, &status, WUNTRACED | WNOHANG);
-                       else
+                       } else {
                                pid = waitpid (-1, &status, WUNTRACED);
+                       }
 
                        /* When interrupted by signal, the signal will be
                         * forwarded to the child, and termination will be
@@ -480,8 +486,9 @@ static void handle_session (void)
 
                                if (caught == SIGWINCH) {
                                        caught = 0;
-                                       if (ioctl (STDIN_FILENO, TIOCGWINSZ, &winsz) != -1)
+                                       if (ioctl (STDIN_FILENO, TIOCGWINSZ, &winsz) != -1) {
                                                (void) ioctl (fd_pts, TIOCSWINSZ, &winsz);
+                                       }
                                }
 
                                FD_ZERO (&inp_fds);
@@ -490,22 +497,25 @@ static void handle_session (void)
                                sel_to = (struct timeval){ 0, 10000};
 
                                if (select (fd_ptmx + 1, &inp_fds, NULL, NULL, &sel_to) == -1) {
-                                       if (errno == EINTR)
+                                       if (errno == EINTR) {
                                                continue;
+                                       }
                                        stop = true;
                                }
                                if (FD_ISSET (STDIN_FILENO, &inp_fds)) {
                                        bytes_r = read (STDIN_FILENO, trbuf, BUFSIZ);
                                        if (bytes_r <= 0) {
-                                               if (errno == EINTR)
+                                               if (errno == EINTR) {
                                                        continue;
+                                               }
                                                fprintf (stderr, _("%s: Failure in reading from stdin\r\n"), Prog);
                                                stop = true;
                                        }
 
                                        if (bytes_r > 0 && write (fd_ptmx, trbuf, bytes_r) != bytes_r) {
-                                               if (errno == EINTR || errno == EIO)
+                                               if (errno == EINTR || errno == EIO) {
                                                        continue;
+                                               }
                                                fprintf (stderr, _("%s: Failure in writing to session\r\n"), Prog);
                                                stop = true;
                                        }
@@ -514,8 +524,9 @@ static void handle_session (void)
                                if (FD_ISSET (fd_ptmx, &inp_fds)) {
                                        bytes_r = read (fd_ptmx, trbuf, BUFSIZ);
                                        if (bytes_r <= 0) {
-                                               if (errno == EINTR || errno == EIO)
+                                               if (errno == EINTR || errno == EIO) {
                                                        continue;
+                                               }
                                                fprintf (stderr, _("%s: Failure in reading from session %d %ld\r\n"), Prog, errno, bytes_r);
                                                stop = true;
                                        }