summaryrefslogtreecommitdiff
path: root/networking/nc.c
diff options
context:
space:
mode:
authorRob Landley2006-07-16 08:14:35 +0000
committerRob Landley2006-07-16 08:14:35 +0000
commit534374755d618c9c36c9940c82756241c4b25a67 (patch)
treefac906b4fa40a68c53cecf20215a7a25b3b1cab6 /networking/nc.c
parentafb94ecf2bb6c53ce2a381d6ce45a426243c76d9 (diff)
downloadbusybox-534374755d618c9c36c9940c82756241c4b25a67.zip
busybox-534374755d618c9c36c9940c82756241c4b25a67.tar.gz
Cleaup read() and write() variants, plus a couple of new functions like
xlseek and fdlength() for the new mkswap.
Diffstat (limited to 'networking/nc.c')
-rw-r--r--networking/nc.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/networking/nc.c b/networking/nc.c
index bda0c40..117bbe2 100644
--- a/networking/nc.c
+++ b/networking/nc.c
@@ -9,8 +9,6 @@
#include "busybox.h"
-#define xread bb_xread
-
static void timeout(int signum)
{
bb_error_msg_and_die("Timed out");
@@ -151,13 +149,14 @@ repeatyness:
for (fd = 0; fd < FD_SETSIZE; fd++) {
if (FD_ISSET(fd, &testfds)) {
- nread = xread(fd, bb_common_bufsiz1, sizeof(bb_common_bufsiz1));
+ nread = safe_read(fd, bb_common_bufsiz1,
+ sizeof(bb_common_bufsiz1));
if (fd == cfd) {
- if (!nread) exit(0);
+ if (nread<1) exit(0);
ofd = STDOUT_FILENO;
} else {
- if (!nread) {
+ if (nread<1) {
// Close outgoing half-connection so they get EOF, but
// leave incoming alone so we can see response.
shutdown(cfd, 1);
@@ -166,8 +165,7 @@ repeatyness:
ofd = cfd;
}
- if (bb_full_write(ofd, bb_common_bufsiz1, nread) < 0)
- bb_perror_msg_and_die(bb_msg_write_error);
+ xwrite(ofd, bb_common_bufsiz1, nread);
if (delay > 0) sleep(delay);
}
}