diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2008-05-22 08:40:04 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2008-05-22 08:40:04 +0000 |
commit | 5eda4f4cbbe5046cebb9d6a24e3311ed8b8b4fbe (patch) | |
tree | f1d22e97816bfec05f996861c4e28e35eb431585 | |
parent | 439224a47e51686faaad75d9ab48b3c0cd0c8c11 (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 snmpd.
"go for it" pyr@, "yeah someone screwed up in the copy" henning@
-rw-r--r-- | usr.sbin/snmpd/buffer.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/usr.sbin/snmpd/buffer.c b/usr.sbin/snmpd/buffer.c index 407bbb8c00f..ad0014ddb13 100644 --- a/usr.sbin/snmpd/buffer.c +++ b/usr.sbin/snmpd/buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buffer.c,v 1.4 2008/03/24 16:11:05 deraadt Exp $ */ +/* $OpenBSD: buffer.c,v 1.5 2008/05/22 08:40:03 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; |