summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2008-05-22 08:35:09 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2008-05-22 08:35:09 +0000
commit439224a47e51686faaad75d9ab48b3c0cd0c8c11 (patch)
tree0c674284d637503865e544041cc1c465280d6a89
parentdeac652aa663abf85938bc5911cf51b625b4fc6a (diff)
- fix a bug in msgbuf_write() that caused a descriptor to stay in the fd
list even after being sent successfully. this has imsg_get_fd() keep returning the first fd. no impact in relayd. "go for it" pyr@, "yeah someone screwed up in the copy" henning@
-rw-r--r--usr.sbin/relayd/buffer.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/usr.sbin/relayd/buffer.c b/usr.sbin/relayd/buffer.c
index 60a39d07e05..5af883d1c8c 100644
--- a/usr.sbin/relayd/buffer.c
+++ b/usr.sbin/relayd/buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buffer.c,v 1.12 2008/03/24 16:11:05 deraadt Exp $ */
+/* $OpenBSD: buffer.c,v 1.13 2008/05/22 08:35:08 gilles Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -203,13 +203,8 @@ msgbuf_write(struct msgbuf *msgbuf)
}
if (buf != NULL && buf->fd != -1) {
- msg.msg_control = (caddr_t)&cmsgbuf.buf;
- msg.msg_controllen = sizeof(cmsgbuf.buf);
- cmsg = CMSG_FIRSTHDR(&msg);
- cmsg->cmsg_len = CMSG_LEN(sizeof(int));
- cmsg->cmsg_level = SOL_SOCKET;
- cmsg->cmsg_type = SCM_RIGHTS;
- *(int *)CMSG_DATA(cmsg) = buf->fd;
+ close(buf->fd);
+ buf->fd = -1;
}
for (buf = TAILQ_FIRST(&msgbuf->bufs); buf != NULL && n > 0;