aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
Diffstat (limited to 'networking')
-rw-r--r--networking/httpd.c16
-rw-r--r--networking/nc.c12
-rw-r--r--networking/tftp.c4
3 files changed, 15 insertions, 17 deletions
diff --git a/networking/httpd.c b/networking/httpd.c
index 4cd09448c..452b56d19 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -961,7 +961,7 @@ static int sendHeaders(HttpResponseNum responseNum)
961#if DEBUG 961#if DEBUG
962 fprintf(stderr, "Headers: '%s'", buf); 962 fprintf(stderr, "Headers: '%s'", buf);
963#endif 963#endif
964 return bb_full_write(a_c_w, buf, len); 964 return full_write(a_c_w, buf, len);
965} 965}
966 966
967/**************************************************************************** 967/****************************************************************************
@@ -1222,7 +1222,7 @@ static int sendCgi(const char *url,
1222 break; 1222 break;
1223 } 1223 }
1224 } else if(post_readed_size > 0 && FD_ISSET(outFd, &writeSet)) { 1224 } else if(post_readed_size > 0 && FD_ISSET(outFd, &writeSet)) {
1225 count = bb_full_write(outFd, wbuf + post_readed_idx, post_readed_size); 1225 count = full_write(outFd, wbuf + post_readed_idx, post_readed_size);
1226 if(count > 0) { 1226 if(count > 0) {
1227 post_readed_size -= count; 1227 post_readed_size -= count;
1228 post_readed_idx += count; 1228 post_readed_idx += count;
@@ -1263,14 +1263,14 @@ static int sendCgi(const char *url,
1263 rbuf[count] = 0; 1263 rbuf[count] = 0;
1264 /* check to see if the user script added headers */ 1264 /* check to see if the user script added headers */
1265 if(strncmp(rbuf, "HTTP/1.0 200 OK\r\n", 4) != 0) { 1265 if(strncmp(rbuf, "HTTP/1.0 200 OK\r\n", 4) != 0) {
1266 bb_full_write(s, "HTTP/1.0 200 OK\r\n", 17); 1266 full_write(s, "HTTP/1.0 200 OK\r\n", 17);
1267 } 1267 }
1268 if (strstr(rbuf, "ontent-") == 0) { 1268 if (strstr(rbuf, "ontent-") == 0) {
1269 bb_full_write(s, "Content-type: text/plain\r\n\r\n", 28); 1269 full_write(s, "Content-type: text/plain\r\n\r\n", 28);
1270 } 1270 }
1271 firstLine = 0; 1271 firstLine = 0;
1272 } 1272 }
1273 if (bb_full_write(s, rbuf, count) != count) 1273 if (full_write(s, rbuf, count) != count)
1274 break; 1274 break;
1275 1275
1276#if DEBUG 1276#if DEBUG
@@ -1337,8 +1337,8 @@ static int sendFile(const char *url)
1337 char *buf = config->buf; 1337 char *buf = config->buf;
1338 1338
1339 sendHeaders(HTTP_OK); 1339 sendHeaders(HTTP_OK);
1340 while ((count = bb_full_read(f, buf, MAX_MEMORY_BUFF)) > 0) { 1340 while ((count = full_read(f, buf, MAX_MEMORY_BUFF)) > 0) {
1341 if (bb_full_write(a_c_w, buf, count) != count) 1341 if (full_write(a_c_w, buf, count) != count)
1342 break; 1342 break;
1343 } 1343 }
1344 close(f); 1344 close(f);
@@ -2000,7 +2000,7 @@ int httpd_main(int argc, char *argv[])
2000# ifdef CONFIG_FEATURE_HTTPD_SETUID 2000# ifdef CONFIG_FEATURE_HTTPD_SETUID
2001 /* drop privileges */ 2001 /* drop privileges */
2002 if(uid > 0) 2002 if(uid > 0)
2003 setuid(uid); 2003 xsetuid(uid);
2004# endif 2004# endif
2005#endif 2005#endif
2006 2006
diff --git a/networking/nc.c b/networking/nc.c
index bda0c407b..117bbe20e 100644
--- a/networking/nc.c
+++ b/networking/nc.c
@@ -9,8 +9,6 @@
9 9
10#include "busybox.h" 10#include "busybox.h"
11 11
12#define xread bb_xread
13
14static void timeout(int signum) 12static void timeout(int signum)
15{ 13{
16 bb_error_msg_and_die("Timed out"); 14 bb_error_msg_and_die("Timed out");
@@ -151,13 +149,14 @@ repeatyness:
151 149
152 for (fd = 0; fd < FD_SETSIZE; fd++) { 150 for (fd = 0; fd < FD_SETSIZE; fd++) {
153 if (FD_ISSET(fd, &testfds)) { 151 if (FD_ISSET(fd, &testfds)) {
154 nread = xread(fd, bb_common_bufsiz1, sizeof(bb_common_bufsiz1)); 152 nread = safe_read(fd, bb_common_bufsiz1,
153 sizeof(bb_common_bufsiz1));
155 154
156 if (fd == cfd) { 155 if (fd == cfd) {
157 if (!nread) exit(0); 156 if (nread<1) exit(0);
158 ofd = STDOUT_FILENO; 157 ofd = STDOUT_FILENO;
159 } else { 158 } else {
160 if (!nread) { 159 if (nread<1) {
161 // Close outgoing half-connection so they get EOF, but 160 // Close outgoing half-connection so they get EOF, but
162 // leave incoming alone so we can see response. 161 // leave incoming alone so we can see response.
163 shutdown(cfd, 1); 162 shutdown(cfd, 1);
@@ -166,8 +165,7 @@ repeatyness:
166 ofd = cfd; 165 ofd = cfd;
167 } 166 }
168 167
169 if (bb_full_write(ofd, bb_common_bufsiz1, nread) < 0) 168 xwrite(ofd, bb_common_bufsiz1, nread);
170 bb_perror_msg_and_die(bb_msg_write_error);
171 if (delay > 0) sleep(delay); 169 if (delay > 0) sleep(delay);
172 } 170 }
173 } 171 }
diff --git a/networking/tftp.c b/networking/tftp.c
index b0572c890..dfa599ab5 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -249,7 +249,7 @@ static int tftp(const int cmd, const struct hostent *host,
249 block_nr++; 249 block_nr++;
250 250
251 if ((cmd & tftp_cmd_put) && (opcode == TFTP_DATA)) { 251 if ((cmd & tftp_cmd_put) && (opcode == TFTP_DATA)) {
252 len = bb_full_read(localfd, cp, tftp_bufsize - 4); 252 len = full_read(localfd, cp, tftp_bufsize - 4);
253 253
254 if (len < 0) { 254 if (len < 0) {
255 bb_perror_msg(bb_msg_read_error); 255 bb_perror_msg(bb_msg_read_error);
@@ -420,7 +420,7 @@ static int tftp(const int cmd, const struct hostent *host,
420 420
421 if (tmp == block_nr) { 421 if (tmp == block_nr) {
422 422
423 len = bb_full_write(localfd, &buf[4], len - 4); 423 len = full_write(localfd, &buf[4], len - 4);
424 424
425 if (len < 0) { 425 if (len < 0) {
426 bb_perror_msg(bb_msg_write_error); 426 bb_perror_msg(bb_msg_write_error);