summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-09-16 01:06:52 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-09-16 01:06:52 +0000
commit7c72298636647f49681f4570506f4cc0ccf9fc77 (patch)
tree61efc86594f680a5a3c7b1ea1ddec7ccec7338a2 /usr.sbin
parent044260725a1578f797e5e57d3b3027040f480832 (diff)
use imsg_add instead of the lower level buf_add in imsg_create; it already
does the error checking for us.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ntpd/imsg.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/usr.sbin/ntpd/imsg.c b/usr.sbin/ntpd/imsg.c
index 41b139f4be6..8d0c0a28d78 100644
--- a/usr.sbin/ntpd/imsg.c
+++ b/usr.sbin/ntpd/imsg.c
@@ -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>
@@ -132,16 +132,13 @@ imsg_create(struct imsgbuf *ibuf, int type, u_int32_t peerid,
hdr.type = type;
hdr.peerid = peerid;
hdr.pid = pid;
- wbuf = buf_open(hdr.len);
- if (wbuf == NULL) {
+ if ((wbuf = buf_open(hdr.len)) == NULL) {
log_warn("imsg_create: buf_open");
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 (wbuf);
}