From 99912ca733dd960f5589227fd999c86e73c8e894 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Tue, 10 Apr 2007 15:43:37 +0000 Subject: audit small applets and mark some of them as NOFORK. Put big scary warnings in relevant places. --- coreutils/cat.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'coreutils/cat.c') 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 @@ #include "busybox.h" +/* This is a NOFORK applet. Be very careful! */ + + int bb_cat(char **argv) { static const char *const argv_dash[] = { "-", NULL }; + FILE *f; int retval = EXIT_SUCCESS; - if (!*argv) argv = (char**) &argv_dash; + if (!*argv) + argv = (char**) &argv_dash; do { f = fopen_or_warn_stdin(*argv); if (f) { + /* This is not an xfunc - never exits */ off_t r = bb_copyfd_eof(fileno(f), STDOUT_FILENO); fclose_if_not_stdin(f); if (r >= 0) -- cgit v1.2.1