diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2005-04-11 20:07:00 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2005-04-11 20:07:00 +0000 |
commit | 329448f75ed82c1ff44ab28c05f16ef7ad17d4bc (patch) | |
tree | 27f661aac620e4c8022f448e2712aa1c035d7b50 /src | |
parent | 0b8c662cf29f330c8e05f6919b85bbd6d9907695 (diff) | |
download | coreutils-329448f75ed82c1ff44ab28c05f16ef7ad17d4bc.tar.xz |
Include stdio-safer.h.
(input_desc): Remove unnecessary static initialization.
(set_input_file): Use STDIN_FILENO, not 0.
(create_output_file): Use fopen_safer.
Diffstat (limited to 'src')
-rw-r--r-- | src/csplit.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/csplit.c b/src/csplit.c index acc83b11b..e627bba1b 100644 --- a/src/csplit.c +++ b/src/csplit.c @@ -31,8 +31,9 @@ #include "error.h" #include "inttostr.h" -#include "safe-read.h" #include "quote.h" +#include "safe-read.h" +#include "stdio-safer.h" #include "xstrtol.h" /* Use SA_NOCLDSTOP as a proxy for whether the sigaction machinery is @@ -130,7 +131,7 @@ void usage (int status); char *program_name; /* Input file descriptor. */ -static int input_desc = 0; +static int input_desc; /* Start of buffer list. */ static struct buffer_record *head = NULL; @@ -643,7 +644,7 @@ static void set_input_file (const char *name) { if (STREQ (name, "-")) - input_desc = 0; + input_desc = STDIN_FILENO; else { input_desc = open (name, O_RDONLY); @@ -939,7 +940,7 @@ create_output_file (void) /* Create the output file in a critical section, to avoid races. */ sigprocmask (SIG_BLOCK, &caught_signals, &oldset); - output_stream = fopen (output_filename, "w"); + output_stream = fopen_safer (output_filename, "w"); fopen_ok = (output_stream != NULL); fopen_errno = errno; files_created += fopen_ok; |