diff options
| author | Jim Meyering <meyering@redhat.com> | 2008-10-12 14:50:02 +0200 |
|---|---|---|
| committer | Jim Meyering <meyering@redhat.com> | 2008-11-10 08:11:59 +0100 |
| commit | 03911ef780eae7d060963bf01ccaf594779b9420 (patch) | |
| tree | e40dd9d866a20c7e88d703557359037dd5661aaf /src/cat.c | |
| parent | xfreopen: new module (diff) | |
| download | coreutils-03911ef780eae7d060963bf01ccaf594779b9420.tar.gz coreutils-03911ef780eae7d060963bf01ccaf594779b9420.zip | |
use xfreopen in place of unchecked freopen
* bootstrap.conf (modules): Add xfreopen.
* src/cat.c (main): Include "xfreopen.h". Use xfreopen.
* src/cksum.c (cksum): Likewise.
* src/head.c (head_file, main): Likewise.
* src/md5sum.c (digest_file): Likewise.
* src/od.c (open_next_file): Likewise.
* src/split.c (type_undef): Likewise.
* src/sum.c (bsd_sum_file, sysv_sum_file): Likewise.
* src/tac.c (tac_file, main): Likewise.
* src/tail.c (tail_file, main): Likewise.
* src/tee.c (tee_files): Likewise.
* src/tr.c (main): Likewise.
* src/wc.c (wc_file): Likewise.
* po/POTFILES.in: Add lib/xfreopen.c
Diffstat (limited to 'src/cat.c')
| -rw-r--r-- | src/cat.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -39,6 +39,7 @@ #include "full-write.h" #include "quote.h" #include "safe-read.h" +#include "xfreopen.h" /* The official name of this program (e.g., no `g' prefix). */ #define PROGRAM_NAME "cat" @@ -664,7 +665,7 @@ main (int argc, char **argv) { file_open_mode |= O_BINARY; if (O_BINARY && ! isatty (STDOUT_FILENO)) - freopen (NULL, "wb", stdout); + xfreopen (NULL, "wb", stdout); } /* Check if any of the input files are the same as the output file. */ @@ -684,7 +685,7 @@ main (int argc, char **argv) have_read_stdin = true; input_desc = STDIN_FILENO; if ((file_open_mode & O_BINARY) && ! isatty (STDIN_FILENO)) - freopen (NULL, "rb", stdin); + xfreopen (NULL, "rb", stdin); } else { |
