mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-18 09:46:33 +02:00
(main): Close STDIN_FILENO rather than a literal `0'.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
2
src/tr.c
2
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);
|
||||
|
||||
Reference in New Issue
Block a user