diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-09-16 01:10:06 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-09-16 01:10:06 +0000 |
commit | 966599e8469056afebfe392b5145ca9abde9ab92 (patch) | |
tree | 01d8432519008dbda54a9086b666227dbafe051a /usr.sbin/ntpd | |
parent | 7c72298636647f49681f4570506f4cc0ccf9fc77 (diff) |
in imsg_compose:
-don't buf_free() on imsg_add() errors, it already does that for us
-use imsg_close() instead of buf_close(), does error handling already
Diffstat (limited to 'usr.sbin/ntpd')
-rw-r--r-- | usr.sbin/ntpd/imsg.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/usr.sbin/ntpd/imsg.c b/usr.sbin/ntpd/imsg.c index 8d0c0a28d78..73b1e273e93 100644 --- a/usr.sbin/ntpd/imsg.c +++ b/usr.sbin/ntpd/imsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.c,v 1.5 2004/09/16 01:06:51 henning Exp $ */ +/* $OpenBSD: imsg.c,v 1.6 2004/09/16 01:10:05 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -101,16 +101,12 @@ imsg_compose(struct imsgbuf *ibuf, int type, u_int32_t peerid, pid_t pid, if ((wbuf = imsg_create(ibuf, type, peerid, pid, datalen)) == NULL) return (-1); - if (imsg_add(wbuf, data, datalen) == -1) { - buf_free(wbuf); + if (imsg_add(wbuf, data, datalen) == -1) + return (-1); + + if ((n = imsg_close(ibuf, wbuf)) < 0) return (-1); - } - if ((n = buf_close(&ibuf->w, wbuf)) < 0) { - log_warnx("imsg_compose: buf_add error"); - buf_free(wbuf); - return (-1); - } return (n); } |