summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2002-08-25 14:32:02 +0000
committerJim Meyering <jim@meyering.net>2002-08-25 14:32:02 +0000
commit3124a4e39341371d69097cf276fc00bd65a0e5f1 (patch)
tree9d09a01198e030ddf72ba599dea3fa7c2631b3a9 /src
parentf7f7207a69ad5e5b1a5a617f6a76986f54888960 (diff)
downloadcoreutils-3124a4e39341371d69097cf276fc00bd65a0e5f1.tar.xz
(main): Close STDIN_FILENO rather than a literal `0'.
Diffstat (limited to 'src')
-rw-r--r--src/cat.c2
-rw-r--r--src/tac.c2
-rw-r--r--src/tail.c2
-rw-r--r--src/tee.c4
-rw-r--r--src/tr.c2
-rw-r--r--src/wc.c2
6 files changed, 7 insertions, 7 deletions
diff --git a/src/cat.c b/src/cat.c
index eb3cd5a4d..72ec1e62c 100644
--- a/src/cat.c
+++ b/src/cat.c
@@ -832,7 +832,7 @@ main (int argc, char **argv)
}
while (++argind < argc);
- if (have_read_stdin && close (0) < 0)
+ if (have_read_stdin && close (STDIN_FILENO) < 0)
error (EXIT_FAILURE, errno, "-");
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
diff --git a/src/tac.c b/src/tac.c
index b0da18ff4..69ec56f8b 100644
--- a/src/tac.c
+++ b/src/tac.c
@@ -710,7 +710,7 @@ main (int argc, char **argv)
/* Flush the output buffer. */
output ((char *) NULL, (char *) NULL);
- if (have_read_stdin && close (0) < 0)
+ if (have_read_stdin && close (STDIN_FILENO) < 0)
error (EXIT_FAILURE, errno, "-");
exit (errors == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
diff --git a/src/tail.c b/src/tail.c
index c6203b1b9..773f32c71 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -1654,7 +1654,7 @@ main (int argc, char **argv)
tail_forever (F, n_files);
}
- if (have_read_stdin && close (0) < 0)
+ if (have_read_stdin && close (STDIN_FILENO) < 0)
error (EXIT_FAILURE, errno, "-");
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
diff --git a/src/tee.c b/src/tee.c
index c71797a47..6fdd5f7e6 100644
--- a/src/tee.c
+++ b/src/tee.c
@@ -1,5 +1,5 @@
/* tee - read from standard input and write to standard output and files.
- Copyright (C) 85,1990-2001 Free Software Foundation, Inc.
+ Copyright (C) 85,1990-2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -147,7 +147,7 @@ main (int argc, char **argv)
POSIX requires that it work when given no arguments. */
errs = tee (argc - optind, (const char **) &argv[optind]);
- if (close (0) != 0)
+ if (close (STDIN_FILENO) != 0)
error (1, errno, _("standard input"));
exit (errs);
diff --git a/src/tr.c b/src/tr.c
index e931990ce..61386746f 100644
--- a/src/tr.c
+++ b/src/tr.c
@@ -2024,7 +2024,7 @@ construct in string1 must be aligned with a corresponding construct\n\
}
}
- if (close (0) != 0)
+ if (close (STDIN_FILENO) != 0)
error (EXIT_FAILURE, errno, _("standard input"));
exit (EXIT_SUCCESS);
diff --git a/src/wc.c b/src/wc.c
index 062a7dd05..2ecb3be24 100644
--- a/src/wc.c
+++ b/src/wc.c
@@ -589,7 +589,7 @@ main (int argc, char **argv)
max_line_length, _("total"));
}
- if (have_read_stdin && close (0))
+ if (have_read_stdin && close (STDIN_FILENO) != 0)
error (EXIT_FAILURE, errno, "-");
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);