diff options
Diffstat (limited to 'coreutils/cat.c')
-rw-r--r-- | coreutils/cat.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/coreutils/cat.c b/coreutils/cat.c index 181d96a2c..989147b39 100644 --- a/coreutils/cat.c +++ b/coreutils/cat.c | |||
@@ -17,18 +17,14 @@ | |||
17 | 17 | ||
18 | int bb_cat(char **argv) | 18 | int bb_cat(char **argv) |
19 | { | 19 | { |
20 | static const char *const argv_dash[] = { "-", NULL }; | ||
21 | |||
22 | int fd; | 20 | int fd; |
23 | int retval = EXIT_SUCCESS; | 21 | int retval = EXIT_SUCCESS; |
24 | 22 | ||
25 | if (!*argv) | 23 | if (!*argv) |
26 | argv = (char**) &argv_dash; | 24 | argv = (char**) &bb_argv_dash; |
27 | 25 | ||
28 | do { | 26 | do { |
29 | fd = STDIN_FILENO; | 27 | fd = open_or_warn_stdin(*argv); |
30 | if (!LONE_DASH(*argv)) | ||
31 | fd = open_or_warn(*argv, O_RDONLY); | ||
32 | if (fd >= 0) { | 28 | if (fd >= 0) { |
33 | /* This is not a xfunc - never exits */ | 29 | /* This is not a xfunc - never exits */ |
34 | off_t r = bb_copyfd_eof(fd, STDOUT_FILENO); | 30 | off_t r = bb_copyfd_eof(fd, STDOUT_FILENO); |