=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/nc/netcat.c,v retrieving revision 1.13 retrieving revision 1.14 diff -c -r1.13 -r1.14 *** src/usr.bin/nc/netcat.c 2000/09/26 05:03:31 1.13 --- src/usr.bin/nc/netcat.c 2000/09/26 05:16:00 1.14 *************** *** 1,4 **** ! /* $OpenBSD: netcat.c,v 1.13 2000/09/26 05:03:31 ericj Exp $ */ /* Netcat 1.10 RELEASE 960320 * --- 1,4 ---- ! /* $OpenBSD: netcat.c,v 1.14 2000/09/26 05:16:00 ericj Exp $ */ /* Netcat 1.10 RELEASE 960320 * *************** *** 487,507 **** struct in_addr *lad; u_short lp; { ! int nnetfd; int rr; int x, y; errno = 0; /* grab a socket; set opts */ ! newskt: ! if (o_udpmode) ! nnetfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); ! else ! nnetfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); ! if (nnetfd < 0) ! nlog(1, "Can't get socket"); ! if (nnetfd == 0) /* if stdin was closed this might *be* 0, */ ! goto newskt; /* so grab another. See text for why... */ x = 1; rr = setsockopt(nnetfd, SOL_SOCKET, SO_REUSEADDR, &x, sizeof(x)); if (rr == -1) --- 487,507 ---- struct in_addr *lad; u_short lp; { ! int nnetfd = 0; int rr; int x, y; errno = 0; /* grab a socket; set opts */ ! while (nnetfd == 0) { ! if (o_udpmode) ! nnetfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); ! else ! nnetfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); ! if (nnetfd < 0) ! nlog(1, "Can't get socket"); ! } ! x = 1; rr = setsockopt(nnetfd, SOL_SOCKET, SO_REUSEADDR, &x, sizeof(x)); if (rr == -1) *************** *** 1365,1385 **** */ void nlog(doexit, fmt) ! char *fmt; { ! va_list args; ! if (o_verbose || doexit) { ! va_start(args, fmt); ! vfprintf(stderr, fmt, args); ! if (h_errno) herror(NULL); ! else ! putc('\n', stderr); ! } ! if (doexit) ! exit(1); } void --- 1365,1385 ---- */ void nlog(doexit, fmt) ! char *fmt; { ! va_list args; ! if (o_verbose || doexit) { ! va_start(args, fmt); ! vfprintf(stderr, fmt, args); ! if (h_errno) herror(NULL); ! else ! putc('\n', stderr); ! } ! if (doexit) ! exit(1); } void