summaryrefslogtreecommitdiff
path: root/src/usr.bin
diff options
context:
space:
mode:
authormestre <>2019-01-10 12:44:54 +0000
committermestre <>2019-01-10 12:44:54 +0000
commit7d5ad0e66b7cd66e61d1d75f07f57890307a72f6 (patch)
tree3bb39592b90d9d0a3543dc17df774e8ee4235675 /src/usr.bin
parent387ee612b4875f4548b64da3172c09277a87bd66 (diff)
downloadopenbsd-7d5ad0e66b7cd66e61d1d75f07f57890307a72f6.tar.gz
openbsd-7d5ad0e66b7cd66e61d1d75f07f57890307a72f6.tar.bz2
openbsd-7d5ad0e66b7cd66e61d1d75f07f57890307a72f6.zip
Revert back previous commit and stop including strings.h
Use memset(3) instead of bzero(3) since POSIX recommends using the former and because it's also more portable (conforms to ANSI C standard) OK tedu@ tb@
Diffstat (limited to 'src/usr.bin')
-rw-r--r--src/usr.bin/nc/netcat.c11
-rw-r--r--src/usr.bin/nc/socks.c5
2 files changed, 7 insertions, 9 deletions
diff --git a/src/usr.bin/nc/netcat.c b/src/usr.bin/nc/netcat.c
index 10f5a50def..afa02343d9 100644
--- a/src/usr.bin/nc/netcat.c
+++ b/src/usr.bin/nc/netcat.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: netcat.c,v 1.201 2019/01/09 12:58:18 inoguchi Exp $ */ 1/* $OpenBSD: netcat.c,v 1.202 2019/01/10 12:44:54 mestre Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> 3 * Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
4 * Copyright (c) 2015 Bob Beck. All rights reserved. 4 * Copyright (c) 2015 Bob Beck. All rights reserved.
@@ -53,7 +53,6 @@
53#include <stdio.h> 53#include <stdio.h>
54#include <stdlib.h> 54#include <stdlib.h>
55#include <string.h> 55#include <string.h>
56#include <strings.h>
57#include <time.h> 56#include <time.h>
58#include <tls.h> 57#include <tls.h>
59#include <unistd.h> 58#include <unistd.h>
@@ -1328,9 +1327,9 @@ fdpass(int nfd)
1328 if (isatty(STDOUT_FILENO)) 1327 if (isatty(STDOUT_FILENO))
1329 errx(1, "Cannot pass file descriptor to tty"); 1328 errx(1, "Cannot pass file descriptor to tty");
1330 1329
1331 bzero(&mh, sizeof(mh)); 1330 memset(&mh, 0, sizeof(mh));
1332 bzero(&cmsgbuf, sizeof(cmsgbuf)); 1331 memset(&cmsgbuf, 0, sizeof(cmsgbuf));
1333 bzero(&iov, sizeof(iov)); 1332 memset(&iov, 0, sizeof(iov));
1334 1333
1335 mh.msg_control = (caddr_t)&cmsgbuf.buf; 1334 mh.msg_control = (caddr_t)&cmsgbuf.buf;
1336 mh.msg_controllen = sizeof(cmsgbuf.buf); 1335 mh.msg_controllen = sizeof(cmsgbuf.buf);
@@ -1345,7 +1344,7 @@ fdpass(int nfd)
1345 mh.msg_iov = &iov; 1344 mh.msg_iov = &iov;
1346 mh.msg_iovlen = 1; 1345 mh.msg_iovlen = 1;
1347 1346
1348 bzero(&pfd, sizeof(pfd)); 1347 memset(&pfd, 0, sizeof(pfd));
1349 pfd.fd = STDOUT_FILENO; 1348 pfd.fd = STDOUT_FILENO;
1350 pfd.events = POLLOUT; 1349 pfd.events = POLLOUT;
1351 for (;;) { 1350 for (;;) {
diff --git a/src/usr.bin/nc/socks.c b/src/usr.bin/nc/socks.c
index 2855f18536..856c3e7446 100644
--- a/src/usr.bin/nc/socks.c
+++ b/src/usr.bin/nc/socks.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: socks.c,v 1.26 2019/01/09 12:58:18 inoguchi Exp $ */ 1/* $OpenBSD: socks.c,v 1.27 2019/01/10 12:44:54 mestre Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1999 Niklas Hallqvist. All rights reserved. 4 * Copyright (c) 1999 Niklas Hallqvist. All rights reserved.
@@ -36,7 +36,6 @@
36#include <stdio.h> 36#include <stdio.h>
37#include <stdlib.h> 37#include <stdlib.h>
38#include <string.h> 38#include <string.h>
39#include <strings.h>
40#include <unistd.h> 39#include <unistd.h>
41#include <resolv.h> 40#include <resolv.h>
42#include <readpassphrase.h> 41#include <readpassphrase.h>
@@ -66,7 +65,7 @@ decode_addrport(const char *h, const char *p, struct sockaddr *addr,
66 int r; 65 int r;
67 struct addrinfo hints, *res; 66 struct addrinfo hints, *res;
68 67
69 bzero(&hints, sizeof(hints)); 68 memset(&hints, 0, sizeof(hints));
70 hints.ai_family = v4only ? PF_INET : PF_UNSPEC; 69 hints.ai_family = v4only ? PF_INET : PF_UNSPEC;
71 hints.ai_flags = numeric ? AI_NUMERICHOST : 0; 70 hints.ai_flags = numeric ? AI_NUMERICHOST : 0;
72 hints.ai_socktype = SOCK_STREAM; 71 hints.ai_socktype = SOCK_STREAM;