summaryrefslogtreecommitdiff
path: root/libbb/copyfd.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-04-10 15:43:37 +0000
committerDenis Vlasenko2007-04-10 15:43:37 +0000
commit99912ca733dd960f5589227fd999c86e73c8e894 (patch)
tree9df947fc08884d498cf76a02204d74b121064134 /libbb/copyfd.c
parentff131b980d524a33d8a43cefe65e14f64a43f2da (diff)
downloadbusybox-99912ca733dd960f5589227fd999c86e73c8e894.zip
busybox-99912ca733dd960f5589227fd999c86e73c8e894.tar.gz
audit small applets and mark some of them as NOFORK.
Put big scary warnings in relevant places.
Diffstat (limited to 'libbb/copyfd.c')
-rw-r--r--libbb/copyfd.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/libbb/copyfd.c b/libbb/copyfd.c
index 805b801..e0596d5 100644
--- a/libbb/copyfd.c
+++ b/libbb/copyfd.c
@@ -7,19 +7,15 @@
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
#include "libbb.h"
-
#if BUFSIZ < 4096
#undef BUFSIZ
#define BUFSIZ 4096
#endif
+/* Used by NOFORK applets (e.g. cat) - must be very careful
+ * when calling xfuncs, allocating memory, with signals, termios, etc... */
static off_t bb_full_fd_action(int src_fd, int dst_fd, off_t size)
{
@@ -27,7 +23,8 @@ static off_t bb_full_fd_action(int src_fd, int dst_fd, off_t size)
off_t total = 0;
RESERVE_CONFIG_BUFFER(buffer, BUFSIZ);
- if (src_fd < 0) goto out;
+ if (src_fd < 0)
+ goto out;
if (!size) {
size = BUFSIZ;