diff options
author | 2008-05-22 08:35:08 +0000 | |
---|---|---|
committer | 2008-05-22 08:35:08 +0000 | |
commit | 45b43956f889e1e130ae7755307ad3ba4d0749a7 (patch) | |
tree | 990457c35619883c467ccdb685231776c860c94a | |
parent | Comparing string literals does not work as the author expected. (diff) | |
download | wireguard-openbsd-45b43956f889e1e130ae7755307ad3ba4d0749a7.tar.xz wireguard-openbsd-45b43956f889e1e130ae7755307ad3ba4d0749a7.zip |
- 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.c | 11 |
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; |