Update imsg*.[ch] from OpenBSD, add some compat bits it needs and remove some

bits it doesn't.
This commit is contained in:
Nicholas Marriott
2017-03-24 10:05:53 +00:00
parent e87d808594
commit 2e5664d2df
9 changed files with 210 additions and 98 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: imsg-buffer.c,v 1.7 2015/07/12 18:40:49 nicm Exp $ */
/* $OpenBSD: imsg-buffer.c,v 1.9 2017/03/17 14:51:26 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -78,7 +78,7 @@ ibuf_realloc(struct ibuf *buf, size_t len)
return (-1);
}
b = realloc(buf->buf, buf->wpos + len);
b = recallocarray(buf->buf, buf->size, buf->wpos + len, 1);
if (b == NULL)
return (-1);
buf->buf = b;
@ -180,6 +180,8 @@ again:
void
ibuf_free(struct ibuf *buf)
{
if (buf == NULL)
return;
free(buf->buf);
free(buf);
}