]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(main): Close STDIN_FILENO rather than a literal `0'.
authorJim Meyering <jim@meyering.net>
Sun, 25 Aug 2002 14:32:02 +0000 (14:32 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 25 Aug 2002 14:32:02 +0000 (14:32 +0000)
src/cat.c
src/tac.c
src/tail.c
src/tee.c
src/tr.c
src/wc.c

index eb3cd5a4da08b2448c0713e3d3ef90d937be6622..72ec1e62c0c7a4611c812b0b7e1c200aa397589c 100644 (file)
--- 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);
index b0da18ff46b6552fadd85344563b7c6fce6ab6be..69ec56f8b62ad35ddb849f724421306072dece56 100644 (file)
--- 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);
 }
index c6203b1b975b92a6bf39e82e02a5671ede272df7..773f32c7148b572a10943f88c35795d86f242817 100644 (file)
@@ -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);
 }
index c71797a47f376df7522c566f53c01f0f2a8a6caf..6fdd5f7e631342f9048e8023e576dbdb8ed28531 100644 (file)
--- 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);
index e931990ce6c345a8ad4d66c82f4b8956db5bd802..61386746f04df1215ba81e0404a53063a669c66f 100644 (file)
--- 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);
index 062a7dd057074a7020f433a18e932bdb470132c4..2ecb3be244817f9252352a84b24b84d4cfcba14a 100644 (file)
--- 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);