httpd: fix handling of range requests
[oweals/busybox.git] / networking / nc.c
index 2f9e174667cfd376d438cc341a1cab76c8de69b9..1b70434ac3f3d1de0e9bd02f85b4a055151419c4 100644 (file)
@@ -6,9 +6,6 @@
  *
  * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  */
-
-#include "libbb.h"
-
 //config:config NC
 //config:      bool "nc"
 //config:      default y
 //config:        -s ADDR, -n, -u, -v, -o FILE, -z options, but loses
 //config:        busybox-specific extensions: -f FILE.
 
+//applet:IF_NC(APPLET(nc, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_NC) += nc.o
+
+#include "libbb.h"
+#include "common_bufsiz.h"
 #if ENABLE_NC_110_COMPAT
 # include "nc_bloaty.c"
 #else
@@ -238,6 +241,8 @@ int nc_main(int argc, char **argv)
        FD_SET(cfd, &readfds);
        FD_SET(STDIN_FILENO, &readfds);
 
+#define iobuf bb_common_bufsiz1
+       setup_common_bufsiz();
        for (;;) {
                int fd;
                int ofd;
@@ -248,11 +253,10 @@ int nc_main(int argc, char **argv)
                if (select(cfd + 1, &testfds, NULL, NULL, NULL) < 0)
                        bb_perror_msg_and_die("select");
 
-#define iobuf bb_common_bufsiz1
                fd = STDIN_FILENO;
                while (1) {
                        if (FD_ISSET(fd, &testfds)) {
-                               nread = safe_read(fd, iobuf, sizeof(iobuf));
+                               nread = safe_read(fd, iobuf, COMMON_BUFSIZE);
                                if (fd == cfd) {
                                        if (nread < 1)
                                                exit(EXIT_SUCCESS);