summaryrefslogtreecommitdiff
path: root/usr.bin/nc
diff options
context:
space:
mode:
authorRicardo Mestre <mestre@cvs.openbsd.org>2019-01-10 12:44:55 +0000
committerRicardo Mestre <mestre@cvs.openbsd.org>2019-01-10 12:44:55 +0000
commitffcdaf8074f6448aec791df81aa20d8378dec2f2 (patch)
treee27956c726f012bb5a89a655e6c8af2960cf7532 /usr.bin/nc
parent2bfc2897ea28168b6595f2a81df447caf3e922de (diff)
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 'usr.bin/nc')
-rw-r--r--usr.bin/nc/netcat.c11
-rw-r--r--usr.bin/nc/socks.c5
2 files changed, 7 insertions, 9 deletions
diff --git a/usr.bin/nc/netcat.c b/usr.bin/nc/netcat.c
index 10f5a50def6..afa02343d98 100644
--- a/usr.bin/nc/netcat.c
+++ b/usr.bin/nc/netcat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: netcat.c,v 1.201 2019/01/09 12:58:18 inoguchi Exp $ */
+/* $OpenBSD: netcat.c,v 1.202 2019/01/10 12:44:54 mestre Exp $ */
/*
* Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
* Copyright (c) 2015 Bob Beck. All rights reserved.
@@ -53,7 +53,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <strings.h>
#include <time.h>
#include <tls.h>
#include <unistd.h>
@@ -1328,9 +1327,9 @@ fdpass(int nfd)
if (isatty(STDOUT_FILENO))
errx(1, "Cannot pass file descriptor to tty");
- bzero(&mh, sizeof(mh));
- bzero(&cmsgbuf, sizeof(cmsgbuf));
- bzero(&iov, sizeof(iov));
+ memset(&mh, 0, sizeof(mh));
+ memset(&cmsgbuf, 0, sizeof(cmsgbuf));
+ memset(&iov, 0, sizeof(iov));
mh.msg_control = (caddr_t)&cmsgbuf.buf;
mh.msg_controllen = sizeof(cmsgbuf.buf);
@@ -1345,7 +1344,7 @@ fdpass(int nfd)
mh.msg_iov = &iov;
mh.msg_iovlen = 1;
- bzero(&pfd, sizeof(pfd));
+ memset(&pfd, 0, sizeof(pfd));
pfd.fd = STDOUT_FILENO;
pfd.events = POLLOUT;
for (;;) {
diff --git a/usr.bin/nc/socks.c b/usr.bin/nc/socks.c
index 2855f18536d..856c3e74463 100644
--- a/usr.bin/nc/socks.c
+++ b/usr.bin/nc/socks.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: socks.c,v 1.26 2019/01/09 12:58:18 inoguchi Exp $ */
+/* $OpenBSD: socks.c,v 1.27 2019/01/10 12:44:54 mestre Exp $ */
/*
* Copyright (c) 1999 Niklas Hallqvist. All rights reserved.
@@ -36,7 +36,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <strings.h>
#include <unistd.h>
#include <resolv.h>
#include <readpassphrase.h>
@@ -66,7 +65,7 @@ decode_addrport(const char *h, const char *p, struct sockaddr *addr,
int r;
struct addrinfo hints, *res;
- bzero(&hints, sizeof(hints));
+ memset(&hints, 0, sizeof(hints));
hints.ai_family = v4only ? PF_INET : PF_UNSPEC;
hints.ai_flags = numeric ? AI_NUMERICHOST : 0;
hints.ai_socktype = SOCK_STREAM;