summaryrefslogtreecommitdiffstats
path: root/compat/imsg.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2010-04-12 21:45:18 +0000
committerTiago Cunha <tcunha@gmx.com>2010-04-12 21:45:18 +0000
commit0646b3caf2716e2305094132665a7eb02f7c143d (patch)
treed014b260cc2231b3def6274a1b5395ae06cac9c7 /compat/imsg.c
parentb2e752b3842ffeb21cd4a8b80bee673d43e88695 (diff)
Sync OpenBSD patchset 680:
Remove XXX comment and just close received fd if calloc() fails. If this happens the imsg may no longer be usable as there may be queued messages, but this is a) already the case with the code now, and b) would be the case if recvmsg() fails anyway, so we can document that -1 from imsg_read() invalidates the struct imsgbuf. discussed with and ok eric
Diffstat (limited to 'compat/imsg.c')
-rw-r--r--compat/imsg.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/compat/imsg.c b/compat/imsg.c
index 2d662d36..d2f55518 100644
--- a/compat/imsg.c
+++ b/compat/imsg.c
@@ -1,5 +1,5 @@
-/* $Id: imsg.c,v 1.3 2009-08-20 12:54:08 nicm Exp $ */
-/* $OpenBSD: imsg.c,v 1.1 2009/08/11 17:18:35 nicm Exp $ */
+/* $Id: imsg.c,v 1.4 2010-04-12 21:45:18 tcunha Exp $ */
+/* $OpenBSD: imsg.c,v 1.2 2010/04/07 18:09:39 nicm Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -79,7 +79,7 @@ imsg_read(struct imsgbuf *ibuf)
cmsg->cmsg_type == SCM_RIGHTS) {
fd = (*(int *)CMSG_DATA(cmsg));
if ((ifd = calloc(1, sizeof(struct imsg_fd))) == NULL) {
- /* XXX: this return can leak */
+ close(fd);
return (-1);
}
ifd->fd = fd;