]> granicus.if.org Git - procps-ng/commitdiff
slabtop, vmstat, watch: remove file descriptor constants
authorSami Kerola <kerolasa@iki.fi>
Thu, 8 Mar 2012 20:49:49 +0000 (21:49 +0100)
committerSami Kerola <kerolasa@iki.fi>
Fri, 16 Mar 2012 12:18:43 +0000 (13:18 +0100)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
slabtop.c
vmstat.c
watch.c

index 17c1fcca6a8db3d51c66479873a94973ac0415db..16863fe2c3fcf549823f96243f8b30873a9ae890 100644 (file)
--- a/slabtop.c
+++ b/slabtop.c
@@ -414,7 +414,7 @@ int main(int argc, char *argv[])
                        tv.tv_sec = delay;
                        tv.tv_usec = 0;
                        if (select(STDOUT_FILENO, &readfds, NULL, NULL, &tv) > 0) {
-                               if (read(0, &c, 1) != 1)
+                               if (read(STDIN_FILENO, &c, 1) != 1)
                                        break;
                                parse_input(c);
                        }
index 9fca4ef4490bd74d4fe9b20d30e2cae09f8045c0..809915a7e807b6881ac709904901f32c07880b6b 100644 (file)
--- a/vmstat.c
+++ b/vmstat.c
@@ -694,7 +694,7 @@ static int winhi(void)
        struct winsize win;
        int rows = 24;
 
-       if (ioctl(1, TIOCGWINSZ, &win) != -1 && win.ws_row > 0)
+       if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &win) != -1 && 0 < win.ws_row)
                rows = win.ws_row;
 
        return rows;
diff --git a/watch.c b/watch.c
index 6ce174ba4d04aad1d01352f576914d4bdf42405a..d759c64b6259190aa9349f18c48a416f653f495f 100644 (file)
--- a/watch.c
+++ b/watch.c
@@ -220,7 +220,7 @@ static void get_terminal_size(void)
                }
        }
        if (incoming_cols < 0 || incoming_rows < 0) {
-               if (ioctl(2, TIOCGWINSZ, &w) == 0) {
+               if (ioctl(STDERR_FILENO, TIOCGWINSZ, &w) == 0) {
                        if (incoming_rows < 0 && w.ws_row > 0) {
                                height = w.ws_row;
                                snprintf(env_row_buf, sizeof env_row_buf,