summaryrefslogtreecommitdiff
path: root/utility.c
diff options
context:
space:
mode:
authorMatt Kraai2000-12-15 22:34:34 +0000
committerMatt Kraai2000-12-15 22:34:34 +0000
commitbfa7967c4a18c9a7addbe853cf9f736ac34b4e5b (patch)
tree8269fa410bbc0b34bcd732c08054dca087b07ba3 /utility.c
parent8677d7b6ec95cc9fa5c98b077680fc7ed4254d40 (diff)
downloadbusybox-bfa7967c4a18c9a7addbe853cf9f736ac34b4e5b.zip
busybox-bfa7967c4a18c9a7addbe853cf9f736ac34b4e5b.tar.gz
Rewrite nc to be simpler, smaller, and to check syscalls for errors.
Diffstat (limited to 'utility.c')
-rw-r--r--utility.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/utility.c b/utility.c
index 02479d9..4654dae 100644
--- a/utility.c
+++ b/utility.c
@@ -536,7 +536,7 @@ const char *time_string(time_t timeVal)
}
#endif /* BB_TAR || BB_AR */
-#if defined BB_TAR || defined BB_CP_MV || defined BB_AR || defined BB_DD
+#if defined BB_AR || defined BB_CP_MV || defined BB_DD || defined BB_NC || defined BB_TAR
/*
* Write all of the supplied buffer out to a file.
* This does multiple writes as necessary.
@@ -1791,6 +1791,19 @@ int applet_name_compare(const void *x, const void *y)
return strcmp(applet1->name, applet2->name);
}
+#if defined BB_NC
+ssize_t safe_read(int fd, void *buf, size_t count)
+{
+ ssize_t n;
+
+ do {
+ n = read(fd, buf, count);
+ } while (n < 0 && errno == EINTR);
+
+ return n;
+}
+#endif
+
/* END CODE */
/*
Local Variables: