Browse Source

use imsg_add instead of the lower level buf_add in imsg_create; it already

does the error checking for us.
OPENBSD_3_7
henning 20 years ago
parent
commit
5d20af9c99
1 changed files with 4 additions and 7 deletions
  1. +4
    -7
      src/usr.sbin/ntpd/imsg.c

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

@ -1,4 +1,4 @@
/* $OpenBSD: imsg.c,v 1.4 2004/09/16 01:02:37 henning Exp $ */
/* $OpenBSD: imsg.c,v 1.5 2004/09/16 01:06:51 henning Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -132,16 +132,13 @@ imsg_create(struct imsgbuf *ibuf, int type, u_int32_t peerid,
hdr.type = type; hdr.type = type;
hdr.peerid = peerid; hdr.peerid = peerid;
hdr.pid = pid; hdr.pid = pid;
wbuf = buf_open(hdr.len);
if (wbuf == NULL) {
if ((wbuf = buf_open(hdr.len)) == NULL) {
log_warn("imsg_create: buf_open"); log_warn("imsg_create: buf_open");
return (NULL); return (NULL);
} }
if (buf_add(wbuf, &hdr, sizeof(hdr)) == -1) {
log_warnx("imsg_create: buf_add error");
buf_free(wbuf);
if (imsg_add(wbuf, &hdr, sizeof(hdr)) == -1)
return (NULL); return (NULL);
}
return (wbuf); return (wbuf);
} }


Loading…
Cancel
Save