aboutsummaryrefslogtreecommitdiff
path: root/compat/imsg-buffer.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2015-07-12 19:46:58 +0100
committerNicholas Marriott <nicholas.marriott@gmail.com>2015-07-12 19:46:58 +0100
commit235e0bd65a49b469d661a9831067e3f745fbbaad (patch)
tree8ecc41212fd73d598e126488913c0a3efeb6c9f8 /compat/imsg-buffer.c
parent8b8a007e8e1faa6af20acdeac728c4fddfeb2f6b (diff)
downloadrtmux-235e0bd65a49b469d661a9831067e3f745fbbaad.tar.gz
rtmux-235e0bd65a49b469d661a9831067e3f745fbbaad.tar.bz2
rtmux-235e0bd65a49b469d661a9831067e3f745fbbaad.zip
Update imsg*.[ch] from OpenBSD, including bzero->memset.
Diffstat (limited to 'compat/imsg-buffer.c')
-rw-r--r--compat/imsg-buffer.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/compat/imsg-buffer.c b/compat/imsg-buffer.c
index 6756de0a..241c4f4d 100644
--- a/compat/imsg-buffer.c
+++ b/compat/imsg-buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imsg-buffer.c,v 1.4 2014/06/30 00:25:17 deraadt Exp $ */
+/* $OpenBSD: imsg-buffer.c,v 1.7 2015/07/12 18:40:49 nicm Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -74,7 +74,7 @@ ibuf_realloc(struct ibuf *buf, size_t len)
/* on static buffers max is eq size and so the following fails */
if (buf->wpos + len > buf->max) {
- errno = ENOMEM;
+ errno = ERANGE;
return (-1);
}
@@ -149,7 +149,7 @@ ibuf_write(struct msgbuf *msgbuf)
unsigned int i = 0;
ssize_t n;
- bzero(&iov, sizeof(iov));
+ memset(&iov, 0, sizeof(iov));
TAILQ_FOREACH(buf, &msgbuf->bufs, entry) {
if (i >= IOV_MAX)
break;
@@ -233,8 +233,9 @@ msgbuf_write(struct msgbuf *msgbuf)
char buf[CMSG_SPACE(sizeof(int))];
} cmsgbuf;
- bzero(&iov, sizeof(iov));
- bzero(&msg, sizeof(msg));
+ memset(&iov, 0, sizeof(iov));
+ memset(&msg, 0, sizeof(msg));
+ memset(&cmsgbuf, 0, sizeof(cmsgbuf));
TAILQ_FOREACH(buf, &msgbuf->bufs, entry) {
if (i >= IOV_MAX)
break;