aboutsummaryrefslogtreecommitdiffstats
path: root/community/lxdm/fix-msghdr-usage.patch
blob: 7840c59b12dc9b9a68196083242c9d4a771365b4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
diff -ru lxdm-0.5.0.orig/src/lxcom.c lxdm-0.5.0/src/lxcom.c
--- lxdm-0.5.0.orig/src/lxcom.c	2013-10-04 10:40:08.000000000 -0300
+++ lxdm-0.5.0/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)