void-packages/srcpkgs/lxdm/patches/fix-msghdr-usage.patch
Đoàn Trần Công Danh 861ac185a6 srcpkgs/l*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

39 lines
993 B
Diff

--- a/src/lxcom.c 2013-10-04 10:40:08.000000000 -0300
+++ b/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)