Browse Source

replace bzero with memset

ok phessler@ deraadt@
OPENBSD_5_8
bcook 9 years ago
parent
commit
cdb73978a9
7 changed files with 19 additions and 19 deletions
  1. +2
    -2
      src/usr.sbin/ntpd/client.c
  2. +4
    -4
      src/usr.sbin/ntpd/config.c
  3. +2
    -2
      src/usr.sbin/ntpd/control.c
  4. +4
    -4
      src/usr.sbin/ntpd/ntp.c
  5. +3
    -3
      src/usr.sbin/ntpd/ntpd.c
  6. +2
    -2
      src/usr.sbin/ntpd/parse.y
  7. +2
    -2
      src/usr.sbin/ntpd/server.c

+ 2
- 2
src/usr.sbin/ntpd/client.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: client.c,v 1.101 2015/03/28 03:49:01 bcook Exp $ */
/* $OpenBSD: client.c,v 1.102 2015/07/18 00:53:44 bcook Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -215,7 +215,7 @@ client_dispatch(struct ntp_peer *p, u_int8_t settime)
double T1, T2, T3, T4; double T1, T2, T3, T4;
time_t interval; time_t interval;
bzero(&somsg, sizeof(somsg));
memset(&somsg, 0, sizeof(somsg));
iov[0].iov_base = buf; iov[0].iov_base = buf;
iov[0].iov_len = sizeof(buf); iov[0].iov_len = sizeof(buf);
somsg.msg_iov = iov; somsg.msg_iov = iov;


+ 4
- 4
src/usr.sbin/ntpd/config.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: config.c,v 1.26 2015/02/10 06:40:08 reyk Exp $ */
/* $OpenBSD: config.c,v 1.27 2015/07/18 00:53:44 bcook Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -65,7 +65,7 @@ host_v4(const char *s)
struct sockaddr_in *sa_in; struct sockaddr_in *sa_in;
struct ntp_addr *h; struct ntp_addr *h;
bzero(&ina, sizeof(struct in_addr));
memset(&ina, 0, sizeof(struct in_addr));
if (inet_pton(AF_INET, s, &ina) != 1) if (inet_pton(AF_INET, s, &ina) != 1)
return (NULL); return (NULL);
@ -86,7 +86,7 @@ host_v6(const char *s)
struct sockaddr_in6 *sa_in6; struct sockaddr_in6 *sa_in6;
struct ntp_addr *h = NULL; struct ntp_addr *h = NULL;
bzero(&hints, sizeof(hints));
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_INET6; hints.ai_family = AF_INET6;
hints.ai_socktype = SOCK_DGRAM; /*dummy*/ hints.ai_socktype = SOCK_DGRAM; /*dummy*/
hints.ai_flags = AI_NUMERICHOST; hints.ai_flags = AI_NUMERICHOST;
@ -128,7 +128,7 @@ host_dns(const char *s, struct ntp_addr **hn)
struct sockaddr_in6 *sa_in6; struct sockaddr_in6 *sa_in6;
struct ntp_addr *h, *hh = NULL; struct ntp_addr *h, *hh = NULL;
bzero(&hints, sizeof(hints));
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_UNSPEC; hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_DGRAM; /* DUMMY */ hints.ai_socktype = SOCK_DGRAM; /* DUMMY */
/* ntpd MUST NOT use AI_ADDRCONFIG here */ /* ntpd MUST NOT use AI_ADDRCONFIG here */


+ 2
- 2
src/usr.sbin/ntpd/control.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: control.c,v 1.5 2015/02/10 06:40:08 reyk Exp $ */
/* $OpenBSD: control.c,v 1.6 2015/07/18 00:53:44 bcook Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -45,7 +45,7 @@ control_init(char *path)
return (-1); return (-1);
} }
bzero(&sa, sizeof(sa));
memset(&sa, 0, sizeof(sa));
sa.sun_family = AF_UNIX; sa.sun_family = AF_UNIX;
if (strlcpy(sa.sun_path, path, sizeof(sa.sun_path)) >= if (strlcpy(sa.sun_path, path, sizeof(sa.sun_path)) >=
sizeof(sa.sun_path)) sizeof(sa.sun_path))


+ 4
- 4
src/usr.sbin/ntpd/ntp.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: ntp.c,v 1.132 2015/05/25 14:58:34 deraadt Exp $ */
/* $OpenBSD: ntp.c,v 1.133 2015/07/18 00:53:44 bcook Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -188,7 +188,7 @@ ntp_main(int pipe_prnt[2], int fd_ctl, struct ntpd_conf *nconf,
TAILQ_FOREACH(p, &conf->ntp_peers, entry) TAILQ_FOREACH(p, &conf->ntp_peers, entry)
client_peer_init(p); client_peer_init(p);
bzero(&conf->status, sizeof(conf->status));
memset(&conf->status, 0, sizeof(conf->status));
conf->freq.num = 0; conf->freq.num = 0;
conf->freq.samples = 0; conf->freq.samples = 0;
@ -246,8 +246,8 @@ ntp_main(int pipe_prnt[2], int fd_ctl, struct ntpd_conf *nconf,
pfd_elms = new_cnt; pfd_elms = new_cnt;
} }
bzero(pfd, sizeof(*pfd) * pfd_elms);
bzero(idx2peer, sizeof(*idx2peer) * idx2peer_elms);
memset(pfd, 0, sizeof(*pfd) * pfd_elms);
memset(idx2peer, 0, sizeof(*idx2peer) * idx2peer_elms);
nextaction = getmonotime() + 3600; nextaction = getmonotime() + 3600;
pfd[PFD_PIPE_MAIN].fd = ibuf_main->fd; pfd[PFD_PIPE_MAIN].fd = ibuf_main->fd;
pfd[PFD_PIPE_MAIN].events = POLLIN; pfd[PFD_PIPE_MAIN].events = POLLIN;


+ 3
- 3
src/usr.sbin/ntpd/ntpd.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: ntpd.c,v 1.93 2015/03/11 19:38:48 jmc Exp $ */
/* $OpenBSD: ntpd.c,v 1.94 2015/07/18 00:53:44 bcook Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -119,7 +119,7 @@ main(int argc, char *argv[])
conffile = CONFFILE; conffile = CONFFILE;
bzero(&lconf, sizeof(lconf));
memset(&lconf, 0, sizeof(lconf));
log_init(1); /* log to stderr until daemonized */ log_init(1); /* log to stderr until daemonized */
@ -557,7 +557,7 @@ ctl_main(int argc, char *argv[])
if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
err(1, "ntpctl: socket"); err(1, "ntpctl: socket");
bzero(&sa, sizeof(sa));
memset(&sa, 0, sizeof(sa));
sa.sun_family = AF_UNIX; sa.sun_family = AF_UNIX;
if (strlcpy(sa.sun_path, sockname, sizeof(sa.sun_path)) >= if (strlcpy(sa.sun_path, sockname, sizeof(sa.sun_path)) >=
sizeof(sa.sun_path)) sizeof(sa.sun_path))


+ 2
- 2
src/usr.sbin/ntpd/parse.y View File

@ -1,4 +1,4 @@
/* $OpenBSD: parse.y,v 1.62 2015/05/17 18:31:32 reyk Exp $ */
/* $OpenBSD: parse.y,v 1.63 2015/07/18 00:53:44 bcook Exp $ */
/* /*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -426,7 +426,7 @@ rtable : RTABLE NUMBER {
void void
opts_default(void) opts_default(void)
{ {
bzero(&opts, sizeof opts);
memset(&opts, 0, sizeof opts);
opts.weight = 1; opts.weight = 1;
opts.rtable = -1; opts.rtable = -1;
opts.stratum = 1; opts.stratum = 1;


+ 2
- 2
src/usr.sbin/ntpd/server.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: server.c,v 1.42 2015/05/19 16:07:38 reyk Exp $ */
/* $OpenBSD: server.c,v 1.43 2015/07/18 00:53:44 bcook Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -175,7 +175,7 @@ server_dispatch(int fd, struct ntpd_conf *lconf)
if (ntp_getmsg((struct sockaddr *)&fsa, buf, size, &query) == -1) if (ntp_getmsg((struct sockaddr *)&fsa, buf, size, &query) == -1)
return (0); return (0);
bzero(&reply, sizeof(reply));
memset(&reply, 0, sizeof(reply));
if (lconf->status.synced) if (lconf->status.synced)
reply.status = lconf->status.leap; reply.status = lconf->status.leap;
else else


Loading…
Cancel
Save