summaryrefslogtreecommitdiff
path: root/regress/netcat.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2015-02-28 08:20:11 -0800
committerDamien Miller <djm@mindrot.org>2015-02-28 08:20:11 -0800
commite47536ba9692d271b8ad89078abdecf0a1c11707 (patch)
treed9cd11a08c7bb5a8e49075ae2c4d7e2479824ea9 /regress/netcat.c
parent02973ad5f6f49d8420e50a392331432b0396c100 (diff)
portability fixes for regress/netcat.c
Mostly avoiding "err(1, NULL)"
Diffstat (limited to 'regress/netcat.c')
-rw-r--r--regress/netcat.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/regress/netcat.c b/regress/netcat.c
index 29e85bf5a..f8fc7eefc 100644
--- a/regress/netcat.c
+++ b/regress/netcat.c
@@ -269,7 +269,7 @@ main(int argc, char *argv[])
269 case 'x': 269 case 'x':
270 xflag = 1; 270 xflag = 1;
271 if ((proxy = strdup(optarg)) == NULL) 271 if ((proxy = strdup(optarg)) == NULL)
272 err(1, NULL); 272 errx(1, "strdup");
273 break; 273 break;
274 case 'z': 274 case 'z':
275 zflag = 1; 275 zflag = 1;
@@ -404,7 +404,7 @@ main(int argc, char *argv[])
404 if (family != AF_UNIX) 404 if (family != AF_UNIX)
405 s = local_listen(host, uport, hints); 405 s = local_listen(host, uport, hints);
406 if (s < 0) 406 if (s < 0)
407 err(1, NULL); 407 err(1, "local_listen");
408 /* 408 /*
409 * For UDP and -k, don't connect the socket, let it 409 * For UDP and -k, don't connect the socket, let it
410 * receive datagrams from multiple socket pairs. 410 * receive datagrams from multiple socket pairs.
@@ -629,7 +629,7 @@ remote_connect(const char *host, const char *port, struct addrinfo hints)
629{ 629{
630 struct addrinfo *res, *res0; 630 struct addrinfo *res, *res0;
631 int s, error; 631 int s, error;
632#ifdef SO_RTABLE 632#if defined(SO_RTABLE) || defined(SO_BINDANY)
633 int on = 1; 633 int on = 1;
634#endif 634#endif
635 635
@@ -762,7 +762,7 @@ local_listen(char *host, char *port, struct addrinfo hints)
762#ifdef SO_REUSEPORT 762#ifdef SO_REUSEPORT
763 ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x)); 763 ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x));
764 if (ret == -1) 764 if (ret == -1)
765 err(1, NULL); 765 err(1, "setsockopt");
766#endif 766#endif
767 set_common_sockopts(s); 767 set_common_sockopts(s);
768 768
@@ -1137,7 +1137,7 @@ build_ports(char *p)
1137 for (cp = lo; cp <= hi; cp++) { 1137 for (cp = lo; cp <= hi; cp++) {
1138 portlist[x] = calloc(1, PORT_MAX_LEN); 1138 portlist[x] = calloc(1, PORT_MAX_LEN);
1139 if (portlist[x] == NULL) 1139 if (portlist[x] == NULL)
1140 err(1, NULL); 1140 errx(1, "calloc");
1141 snprintf(portlist[x], PORT_MAX_LEN, "%d", cp); 1141 snprintf(portlist[x], PORT_MAX_LEN, "%d", cp);
1142 x++; 1142 x++;
1143 } 1143 }
@@ -1160,7 +1160,7 @@ build_ports(char *p)
1160 errx(1, "port number %s: %s", errstr, p); 1160 errx(1, "port number %s: %s", errstr, p);
1161 portlist[0] = strdup(p); 1161 portlist[0] = strdup(p);
1162 if (portlist[0] == NULL) 1162 if (portlist[0] == NULL)
1163 err(1, NULL); 1163 errx(1, "strdup");
1164 } 1164 }
1165} 1165}
1166 1166
@@ -1192,13 +1192,13 @@ set_common_sockopts(int s)
1192 if (Sflag) { 1192 if (Sflag) {
1193 if (setsockopt(s, IPPROTO_TCP, TCP_MD5SIG, 1193 if (setsockopt(s, IPPROTO_TCP, TCP_MD5SIG,
1194 &x, sizeof(x)) == -1) 1194 &x, sizeof(x)) == -1)
1195 err(1, NULL); 1195 err(1, "setsockopt");
1196 } 1196 }
1197#endif 1197#endif
1198 if (Dflag) { 1198 if (Dflag) {
1199 if (setsockopt(s, SOL_SOCKET, SO_DEBUG, 1199 if (setsockopt(s, SOL_SOCKET, SO_DEBUG,
1200 &x, sizeof(x)) == -1) 1200 &x, sizeof(x)) == -1)
1201 err(1, NULL); 1201 err(1, "setsockopt");
1202 } 1202 }
1203 if (Tflag != -1) { 1203 if (Tflag != -1) {
1204 if (setsockopt(s, IPPROTO_IP, IP_TOS, 1204 if (setsockopt(s, IPPROTO_IP, IP_TOS,