From ffcdaf8074f6448aec791df81aa20d8378dec2f2 Mon Sep 17 00:00:00 2001 From: Ricardo Mestre Date: Thu, 10 Jan 2019 12:44:55 +0000 Subject: 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@ --- usr.bin/nc/netcat.c | 11 +++++------ usr.bin/nc/socks.c | 5 ++--- 2 files changed, 7 insertions(+), 9 deletions(-) (limited to 'usr.bin/nc') 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 * Copyright (c) 2015 Bob Beck. All rights reserved. @@ -53,7 +53,6 @@ #include #include #include -#include #include #include #include @@ -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 #include #include -#include #include #include #include @@ -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; -- cgit v1.2.3