commit | be9f44a7dfb225f03b68ad9c94539528458c84ff | [log] [tgz] |
---|---|---|
author | Matt Kraai <kraai@debian.org> | Tue May 15 03:05:39 2001 +0000 |
committer | Matt Kraai <kraai@debian.org> | Tue May 15 03:05:39 2001 +0000 |
tree | 5ef3cd183275014e52162978a2e49016cd72e0ac | |
parent | 336480fe6f6539a9b6f1649157db2243445e3334 [diff] [blame] |
Fix incorrect length passed to accept noted by Larry Doolittle.
diff --git a/nc.c b/nc.c index 72439dd..b58bd6a 100644 --- a/nc.c +++ b/nc.c
@@ -80,10 +80,12 @@ } if (do_listen) { + socklen_t addrlen = sizeof(address); + if (listen(sfd, 1) < 0) perror_msg_and_die("listen"); - if ((tmpfd = accept(sfd, (struct sockaddr *) &address, &opt)) < 0) + if ((tmpfd = accept(sfd, (struct sockaddr *) &address, &addrlen)) < 0) perror_msg_and_die("accept"); close(sfd);