summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorEric Andersen2002-05-05 03:40:14 +0000
committerEric Andersen2002-05-05 03:40:14 +0000
commitf63a20ad7baf5471f2691e8347bf243eb5935d86 (patch)
tree8e954bf4369446292eceec5bc748ccf5ad4ee75a /networking
parent864b79791a8367d9f8ea2c18eba31fea65bf511a (diff)
downloadbusybox-f63a20ad7baf5471f2691e8347bf243eb5935d86.zip
busybox-f63a20ad7baf5471f2691e8347bf243eb5935d86.tar.gz
Tom Oehser noticed that we were lacking the SO_REUSEADDR flag.
Diffstat (limited to 'networking')
-rw-r--r--networking/nc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/networking/nc.c b/networking/nc.c
index e1741cd..63d8c5b 100644
--- a/networking/nc.c
+++ b/networking/nc.c
@@ -44,7 +44,7 @@
int nc_main(int argc, char **argv)
{
- int do_listen = 0, lport = 0, delay = 0, tmpfd, opt, sfd;
+ int do_listen = 0, lport = 0, delay = 0, tmpfd, opt, sfd, x;
char buf[BUFSIZ];
#ifdef GAPING_SECURITY_HOLE
char * pr00gie = NULL;
@@ -89,7 +89,9 @@ int nc_main(int argc, char **argv)
if ((sfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
perror_msg_and_die("socket");
-
+ x = 1;
+ if (setsockopt (sfd, SOL_SOCKET, SO_REUSEADDR, &x, sizeof (x)) == -1)
+ perror_msg_and_die ("reuseaddr failed");
address.sin_family = AF_INET;
if (lport != 0) {