aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
Diffstat (limited to 'networking')
-rw-r--r--networking/httpd.c24
-rw-r--r--networking/httpd_indexcgi.c2
-rw-r--r--networking/nc_bloaty.c12
-rw-r--r--networking/telnet.c10
4 files changed, 24 insertions, 24 deletions
diff --git a/networking/httpd.c b/networking/httpd.c
index 4094061a8..4da7e5c65 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -947,7 +947,7 @@ static void log_and_exit(void)
947 /* Why?? 947 /* Why??
948 (this also messes up stdin when user runs httpd -i from terminal) 948 (this also messes up stdin when user runs httpd -i from terminal)
949 ndelay_on(0); 949 ndelay_on(0);
950 while (read(0, iobuf, IOBUF_SIZE) > 0) 950 while (read(STDIN_FILENO, iobuf, IOBUF_SIZE) > 0)
951 continue; 951 continue;
952 */ 952 */
953 953
@@ -1023,7 +1023,7 @@ static void send_headers(int responseNum)
1023 1023
1024 if (DEBUG) 1024 if (DEBUG)
1025 fprintf(stderr, "headers: '%s'\n", iobuf); 1025 fprintf(stderr, "headers: '%s'\n", iobuf);
1026 full_write(1, iobuf, len); 1026 full_write(STDOUT_FILENO, iobuf, len);
1027 if (DEBUG) 1027 if (DEBUG)
1028 fprintf(stderr, "writing error page: '%s'\n", error_page); 1028 fprintf(stderr, "writing error page: '%s'\n", error_page);
1029 return send_file_and_exit(error_page, SEND_BODY); 1029 return send_file_and_exit(error_page, SEND_BODY);
@@ -1062,7 +1062,7 @@ static void send_headers(int responseNum)
1062 } 1062 }
1063 if (DEBUG) 1063 if (DEBUG)
1064 fprintf(stderr, "headers: '%s'\n", iobuf); 1064 fprintf(stderr, "headers: '%s'\n", iobuf);
1065 if (full_write(1, iobuf, len) != len) { 1065 if (full_write(STDOUT_FILENO, iobuf, len) != len) {
1066 if (verbose > 1) 1066 if (verbose > 1)
1067 bb_perror_msg("error"); 1067 bb_perror_msg("error");
1068 log_and_exit(); 1068 log_and_exit();
@@ -1090,7 +1090,7 @@ static int get_line(void)
1090 1090
1091 while (1) { 1091 while (1) {
1092 if (hdr_cnt <= 0) { 1092 if (hdr_cnt <= 0) {
1093 hdr_cnt = safe_read(0, hdr_buf, sizeof(hdr_buf)); 1093 hdr_cnt = safe_read(STDIN_FILENO, hdr_buf, sizeof(hdr_buf));
1094 if (hdr_cnt <= 0) 1094 if (hdr_cnt <= 0)
1095 break; 1095 break;
1096 hdr_ptr = hdr_buf; 1096 hdr_ptr = hdr_buf;
@@ -1202,8 +1202,8 @@ static NOINLINE void cgi_io_loop_and_exit(int fromCgi_rd, int toCgi_wr, int post
1202 * and there *is* data to read from the peer 1202 * and there *is* data to read from the peer
1203 * (POSTDATA) */ 1203 * (POSTDATA) */
1204 //count = post_len > (int)sizeof(hdr_buf) ? (int)sizeof(hdr_buf) : post_len; 1204 //count = post_len > (int)sizeof(hdr_buf) ? (int)sizeof(hdr_buf) : post_len;
1205 //count = safe_read(0, hdr_buf, count); 1205 //count = safe_read(STDIN_FILENO, hdr_buf, count);
1206 count = safe_read(0, hdr_buf, sizeof(hdr_buf)); 1206 count = safe_read(STDIN_FILENO, hdr_buf, sizeof(hdr_buf));
1207 if (count > 0) { 1207 if (count > 0) {
1208 hdr_cnt = count; 1208 hdr_cnt = count;
1209 hdr_ptr = hdr_buf; 1209 hdr_ptr = hdr_buf;
@@ -1237,8 +1237,8 @@ static NOINLINE void cgi_io_loop_and_exit(int fromCgi_rd, int toCgi_wr, int post
1237 /* eof (or error) and there was no "HTTP", 1237 /* eof (or error) and there was no "HTTP",
1238 * so write it, then write received data */ 1238 * so write it, then write received data */
1239 if (out_cnt) { 1239 if (out_cnt) {
1240 full_write(1, HTTP_200, sizeof(HTTP_200)-1); 1240 full_write(STDOUT_FILENO, HTTP_200, sizeof(HTTP_200)-1);
1241 full_write(1, rbuf, out_cnt); 1241 full_write(STDOUT_FILENO, rbuf, out_cnt);
1242 } 1242 }
1243 break; /* CGI stdout is closed, exiting */ 1243 break; /* CGI stdout is closed, exiting */
1244 } 1244 }
@@ -1247,7 +1247,7 @@ static NOINLINE void cgi_io_loop_and_exit(int fromCgi_rd, int toCgi_wr, int post
1247 /* "Status" header format is: "Status: 302 Redirected\r\n" */ 1247 /* "Status" header format is: "Status: 302 Redirected\r\n" */
1248 if (out_cnt >= 8 && memcmp(rbuf, "Status: ", 8) == 0) { 1248 if (out_cnt >= 8 && memcmp(rbuf, "Status: ", 8) == 0) {
1249 /* send "HTTP/1.0 " */ 1249 /* send "HTTP/1.0 " */
1250 if (full_write(1, HTTP_200, 9) != 9) 1250 if (full_write(STDOUT_FILENO, HTTP_200, 9) != 9)
1251 break; 1251 break;
1252 rbuf += 8; /* skip "Status: " */ 1252 rbuf += 8; /* skip "Status: " */
1253 count = out_cnt - 8; 1253 count = out_cnt - 8;
@@ -1256,7 +1256,7 @@ static NOINLINE void cgi_io_loop_and_exit(int fromCgi_rd, int toCgi_wr, int post
1256 /* Did CGI add "HTTP"? */ 1256 /* Did CGI add "HTTP"? */
1257 if (memcmp(rbuf, HTTP_200, 4) != 0) { 1257 if (memcmp(rbuf, HTTP_200, 4) != 0) {
1258 /* there is no "HTTP", do it ourself */ 1258 /* there is no "HTTP", do it ourself */
1259 if (full_write(1, HTTP_200, sizeof(HTTP_200)-1) != sizeof(HTTP_200)-1) 1259 if (full_write(STDOUT_FILENO, HTTP_200, sizeof(HTTP_200)-1) != sizeof(HTTP_200)-1)
1260 break; 1260 break;
1261 } 1261 }
1262 /* Commented out: 1262 /* Commented out:
@@ -1276,7 +1276,7 @@ static NOINLINE void cgi_io_loop_and_exit(int fromCgi_rd, int toCgi_wr, int post
1276 if (count <= 0) 1276 if (count <= 0)
1277 break; /* eof (or error) */ 1277 break; /* eof (or error) */
1278 } 1278 }
1279 if (full_write(1, rbuf, count) != count) 1279 if (full_write(STDOUT_FILENO, rbuf, count) != count)
1280 break; 1280 break;
1281 if (DEBUG) 1281 if (DEBUG)
1282 fprintf(stderr, "cgi read %d bytes: '%.*s'\n", count, count, rbuf); 1282 fprintf(stderr, "cgi read %d bytes: '%.*s'\n", count, count, rbuf);
@@ -1632,7 +1632,7 @@ static void send_file_and_exit(const char *url, int what)
1632 while ((count = safe_read(f, iobuf, IOBUF_SIZE)) > 0) { 1632 while ((count = safe_read(f, iobuf, IOBUF_SIZE)) > 0) {
1633 ssize_t n; 1633 ssize_t n;
1634 USE_FEATURE_HTTPD_RANGES(if (count > range_len) count = range_len;) 1634 USE_FEATURE_HTTPD_RANGES(if (count > range_len) count = range_len;)
1635 n = full_write(1, iobuf, count); 1635 n = full_write(STDOUT_FILENO, iobuf, count);
1636 if (count != n) 1636 if (count != n)
1637 break; 1637 break;
1638 USE_FEATURE_HTTPD_RANGES(range_len -= count;) 1638 USE_FEATURE_HTTPD_RANGES(range_len -= count;)
diff --git a/networking/httpd_indexcgi.c b/networking/httpd_indexcgi.c
index fd64af38f..94c6a692a 100644
--- a/networking/httpd_indexcgi.c
+++ b/networking/httpd_indexcgi.c
@@ -125,7 +125,7 @@ static void guarantee(int size)
125{ 125{
126 if (buffer + (BUFFER_SIZE-HEADROOM) - dst >= size) 126 if (buffer + (BUFFER_SIZE-HEADROOM) - dst >= size)
127 return; 127 return;
128 write(1, buffer, dst - buffer); 128 write(STDOUT_FILENO, buffer, dst - buffer);
129 dst = buffer; 129 dst = buffer;
130} 130}
131 131
diff --git a/networking/nc_bloaty.c b/networking/nc_bloaty.c
index 4ba726eb5..5f7bd0372 100644
--- a/networking/nc_bloaty.c
+++ b/networking/nc_bloaty.c
@@ -562,7 +562,7 @@ static int readwrite(void)
562 /* if we have a timeout AND stdin is closed AND we haven't heard anything 562 /* if we have a timeout AND stdin is closed AND we haven't heard anything
563 from the net during that time, assume it's dead and close it too. */ 563 from the net during that time, assume it's dead and close it too. */
564 if (rr == 0) { 564 if (rr == 0) {
565 if (!FD_ISSET(0, &ding1)) 565 if (!FD_ISSET(STDIN_FILENO, &ding1))
566 netretry--; /* we actually try a coupla times. */ 566 netretry--; /* we actually try a coupla times. */
567 if (!netretry) { 567 if (!netretry) {
568 if (o_verbose > 1) /* normally we don't care */ 568 if (o_verbose > 1) /* normally we don't care */
@@ -597,12 +597,12 @@ Debug("got %d from the net, errno %d", rr, errno);
597 goto shovel; 597 goto shovel;
598 598
599 /* okay, suck more stdin */ 599 /* okay, suck more stdin */
600 if (FD_ISSET(0, &ding2)) { /* stdin: ding! */ 600 if (FD_ISSET(STDIN_FILENO, &ding2)) { /* stdin: ding! */
601 rr = read(0, bigbuf_in, BIGSIZ); 601 rr = read(STDIN_FILENO, bigbuf_in, BIGSIZ);
602 /* Considered making reads here smaller for UDP mode, but 8192-byte 602 /* Considered making reads here smaller for UDP mode, but 8192-byte
603 mobygrams are kinda fun and exercise the reassembler. */ 603 mobygrams are kinda fun and exercise the reassembler. */
604 if (rr <= 0) { /* at end, or fukt, or ... */ 604 if (rr <= 0) { /* at end, or fukt, or ... */
605 FD_CLR(0, &ding1); /* disable and close stdin */ 605 FD_CLR(STDIN_FILENO, &ding1); /* disable and close stdin */
606 close(0); 606 close(0);
607 } else { 607 } else {
608 rzleft = rr; 608 rzleft = rr;
@@ -625,7 +625,7 @@ Debug("got %d from the net, errno %d", rr, errno);
625 return 1; 625 return 1;
626 } 626 }
627 if (rnleft) { 627 if (rnleft) {
628 rr = write(1, np, rnleft); 628 rr = write(STDOUT_FILENO, np, rnleft);
629 if (rr > 0) { 629 if (rr > 0) {
630 if (o_ofile) /* log the stdout */ 630 if (o_ofile) /* log the stdout */
631 oprint('<', (unsigned char *)np, rr); 631 oprint('<', (unsigned char *)np, rr);
@@ -783,7 +783,7 @@ int nc_main(int argc, char **argv)
783 } 783 }
784#endif 784#endif
785 785
786 FD_SET(0, &ding1); /* stdin *is* initially open */ 786 FD_SET(STDIN_FILENO, &ding1); /* stdin *is* initially open */
787 if (proggie) { 787 if (proggie) {
788 close(0); /* won't need stdin */ 788 close(0); /* won't need stdin */
789 option_mask32 &= ~OPT_o; /* -o with -e is meaningless! */ 789 option_mask32 &= ~OPT_o; /* -o with -e is meaningless! */
diff --git a/networking/telnet.c b/networking/telnet.c
index b357e690c..3a06c167c 100644
--- a/networking/telnet.c
+++ b/networking/telnet.c
@@ -121,7 +121,7 @@ static void conescape(void)
121 " z suspend telnet\r\n" 121 " z suspend telnet\r\n"
122 " e exit telnet\r\n"); 122 " e exit telnet\r\n");
123 123
124 if (read(0, &b, 1) <= 0) 124 if (read(STDIN_FILENO, &b, 1) <= 0)
125 doexit(EXIT_FAILURE); 125 doexit(EXIT_FAILURE);
126 126
127 switch (b) { 127 switch (b) {
@@ -256,7 +256,7 @@ static void handlenetinput(int len)
256 } 256 }
257 257
258 if (len) 258 if (len)
259 write(1, G.buf, len); 259 write(STDOUT_FILENO, G.buf, len);
260} 260}
261 261
262static void putiac(int c) 262static void putiac(int c)
@@ -601,7 +601,7 @@ int telnet_main(int argc, char **argv)
601 ufds[0].events = ufds[1].events = POLLIN; 601 ufds[0].events = ufds[1].events = POLLIN;
602#else 602#else
603 FD_ZERO(&readfds); 603 FD_ZERO(&readfds);
604 FD_SET(0, &readfds); 604 FD_SET(STDIN_FILENO, &readfds);
605 FD_SET(G.netfd, &readfds); 605 FD_SET(G.netfd, &readfds);
606 maxfd = G.netfd + 1; 606 maxfd = G.netfd + 1;
607#endif 607#endif
@@ -629,10 +629,10 @@ int telnet_main(int argc, char **argv)
629#ifdef USE_POLL 629#ifdef USE_POLL
630 if (ufds[0].revents) /* well, should check POLLIN, but ... */ 630 if (ufds[0].revents) /* well, should check POLLIN, but ... */
631#else 631#else
632 if (FD_ISSET(0, &rfds)) 632 if (FD_ISSET(STDIN_FILENO, &rfds))
633#endif 633#endif
634 { 634 {
635 len = read(0, G.buf, DATABUFSIZE); 635 len = read(STDIN_FILENO, G.buf, DATABUFSIZE);
636 if (len <= 0) 636 if (len <= 0)
637 doexit(EXIT_SUCCESS); 637 doexit(EXIT_SUCCESS);
638 TRACE(0, ("Read con: %d\n", len)); 638 TRACE(0, ("Read con: %d\n", len));