void-packages/srcpkgs/lxdm/patches/fix-msghdr-usage.patch
2015-05-15 09:14:52 +02:00

39 lines
989 B
Diff

--- src/lxcom.c 2013-10-04 10:40:08.000000000 -0300
+++ src/lxcom.c 2014-07-18 11:21:22.734631159 -0300
@@ -116,12 +116,20 @@
char buf[4096];
char ctrl[/*CMSG_SPACE(sizeof(LXDM_CRED))*/1024];
struct sockaddr_un peer;
- struct iovec v={buf,sizeof(buf)};
- struct msghdr h={&peer,sizeof(peer),&v,1,ctrl,sizeof(ctrl),0};
struct cmsghdr *cmptr;
int ret;
- while(1)
+ while (1)
{
+ struct iovec v={buf,sizeof(buf)};
+ struct msghdr h={
+ .msg_name = &peer,
+ .msg_namelen = sizeof(peer),
+ .msg_iov = &v,
+ .msg_iovlen = 1,
+ .msg_control = ctrl,
+ .msg_controllen = sizeof(ctrl)
+ };
+
peer.sun_family=0;
ret=recvmsg(self_server_fd,&h,0);
@@ -315,7 +323,10 @@
static ssize_t lxcom_write(int s,const void *buf,size_t count)
{
struct iovec iov[1] ={{(void*)buf,count,}};
- struct msghdr msg = { 0, 0, iov, 1, 0, 0, 0 };
+ struct msghdr msg = {
+ .msg_iov = iov,
+ .msg_iovlen = 1
+ };
#if !defined(linux) && !defined(__NetBSD__)
#if defined(__sun)