-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add fixes from 6.8, add new pkgconfig file
update patch version to 6.8.2 Signed-off-by: Aisha Tammy <[email protected]>
- Loading branch information
Showing
4 changed files
with
36 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
prefix=@PREFIX@ | ||
libdir=${prefix}/@LIBDIR@ | ||
includedir=${prefix}/include | ||
|
||
Name: IMSG | ||
Version: 9999 | ||
Description: Unofficial OpenBSD imsg port | ||
URL: https://github.com/bsd-ac/imsg-compat | ||
|
||
Cflags: -I${includedir} | ||
Libs: -L${libdir} -limsg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* $OpenBSD: imsg-buffer.c,v 1.12 2019/01/20 02:50:03 bcook Exp $ */ | ||
/* $OpenBSD: imsg-buffer.c,v 1.13 2021/03/31 17:42:24 eric Exp $ */ | ||
|
||
/* | ||
* Copyright (c) 2003, 2004 Henning Brauer <[email protected]> | ||
|
@@ -226,7 +226,7 @@ int | |
msgbuf_write(struct msgbuf *msgbuf) | ||
{ | ||
struct iovec iov[IOV_MAX]; | ||
struct ibuf *buf; | ||
struct ibuf *buf, *buf0 = NULL; | ||
unsigned int i = 0; | ||
ssize_t n; | ||
struct msghdr msg; | ||
|
@@ -242,24 +242,26 @@ msgbuf_write(struct msgbuf *msgbuf) | |
TAILQ_FOREACH(buf, &msgbuf->bufs, entry) { | ||
if (i >= IOV_MAX) | ||
break; | ||
if (i > 0 && buf->fd != -1) | ||
break; | ||
iov[i].iov_base = buf->buf + buf->rpos; | ||
iov[i].iov_len = buf->wpos - buf->rpos; | ||
i++; | ||
if (buf->fd != -1) | ||
break; | ||
buf0 = buf; | ||
} | ||
|
||
msg.msg_iov = iov; | ||
msg.msg_iovlen = i; | ||
|
||
if (buf != NULL && buf->fd != -1) { | ||
if (buf0 != NULL) { | ||
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; | ||
*(int *)CMSG_DATA(cmsg) = buf0->fd; | ||
} | ||
|
||
again: | ||
|
@@ -280,9 +282,9 @@ msgbuf_write(struct msgbuf *msgbuf) | |
* assumption: fd got sent if sendmsg sent anything | ||
* this works because fds are passed one at a time | ||
*/ | ||
if (buf != NULL && buf->fd != -1) { | ||
close(buf->fd); | ||
buf->fd = -1; | ||
if (buf0 != NULL) { | ||
close(buf0->fd); | ||
buf0->fd = -1; | ||
} | ||
|
||
msgbuf_drain(msgbuf, n); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* $OpenBSD: imsg.h,v 1.5 2019/01/20 02:50:03 bcook Exp $ */ | ||
/* $OpenBSD: imsg.h,v 1.6 2021/01/13 09:56:28 claudio Exp $ */ | ||
|
||
/* | ||
* Copyright (c) 2006, 2007 Pierre-Yves Ritschard <[email protected]> | ||
|
@@ -78,6 +78,7 @@ struct imsg { | |
void *data; | ||
}; | ||
|
||
struct iovec; | ||
|
||
/* buffer.c */ | ||
struct ibuf *ibuf_open(size_t); | ||
|