diff options
Diffstat (limited to 'coreutils/cat.c')
-rw-r--r-- | coreutils/cat.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/coreutils/cat.c b/coreutils/cat.c index 7bab325ef..eb141dc79 100644 --- a/coreutils/cat.c +++ b/coreutils/cat.c | |||
@@ -12,17 +12,23 @@ | |||
12 | 12 | ||
13 | #include "busybox.h" | 13 | #include "busybox.h" |
14 | 14 | ||
15 | /* This is a NOFORK applet. Be very careful! */ | ||
16 | |||
17 | |||
15 | int bb_cat(char **argv) | 18 | int bb_cat(char **argv) |
16 | { | 19 | { |
17 | static const char *const argv_dash[] = { "-", NULL }; | 20 | static const char *const argv_dash[] = { "-", NULL }; |
21 | |||
18 | FILE *f; | 22 | FILE *f; |
19 | int retval = EXIT_SUCCESS; | 23 | int retval = EXIT_SUCCESS; |
20 | 24 | ||
21 | if (!*argv) argv = (char**) &argv_dash; | 25 | if (!*argv) |
26 | argv = (char**) &argv_dash; | ||
22 | 27 | ||
23 | do { | 28 | do { |
24 | f = fopen_or_warn_stdin(*argv); | 29 | f = fopen_or_warn_stdin(*argv); |
25 | if (f) { | 30 | if (f) { |
31 | /* This is not an xfunc - never exits */ | ||
26 | off_t r = bb_copyfd_eof(fileno(f), STDOUT_FILENO); | 32 | off_t r = bb_copyfd_eof(fileno(f), STDOUT_FILENO); |
27 | fclose_if_not_stdin(f); | 33 | fclose_if_not_stdin(f); |
28 | if (r >= 0) | 34 | if (r >= 0) |