aboutsummaryrefslogtreecommitdiff
path: root/coreutils/cat.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-04-10 15:43:37 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-04-10 15:43:37 +0000
commit99912ca733dd960f5589227fd999c86e73c8e894 (patch)
tree9df947fc08884d498cf76a02204d74b121064134 /coreutils/cat.c
parentff131b980d524a33d8a43cefe65e14f64a43f2da (diff)
downloadbusybox-w32-99912ca733dd960f5589227fd999c86e73c8e894.tar.gz
busybox-w32-99912ca733dd960f5589227fd999c86e73c8e894.tar.bz2
busybox-w32-99912ca733dd960f5589227fd999c86e73c8e894.zip
audit small applets and mark some of them as NOFORK.
Put big scary warnings in relevant places.
Diffstat (limited to 'coreutils/cat.c')
-rw-r--r--coreutils/cat.c8
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
15int bb_cat(char **argv) 18int 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)