void-packages/srcpkgs/acpid/patches/portability.patch
Đoàn Trần Công Danh ae69000001 srcpkgs/a*: convert patches to -Np1
* arduino and antiword is kept at -Np0

```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

59 lines
1.4 KiB
Diff

Portability fixes:
- Do not use isfdtype()... rather use fstat(2).
- Define TEMP_FAILURE_RETRY if needed.
--- a/acpid.h 2014-02-26 01:36:58.788146100 +0100
+++ b/acpid.h 2014-12-28 06:58:18.252702509 +0100
@@ -39,6 +39,15 @@
#define PACKAGE "acpid"
+#ifndef TEMP_FAILURE_RETRY
+# define TEMP_FAILURE_RETRY(expression) \
+ (__extension__ \
+ ({ long int __result; \
+ do __result = (long int) (expression); \
+ while (__result == -1L && errno == EINTR); \
+ __result; }))
+#endif
+
/*
* acpid.c
*/
--- a/kacpimon/libnetlink.c 2013-02-24 14:20:06.624844873 +0100
+++ b/kacpimon/libnetlink.c 2014-12-28 06:59:50.283706615 +0100
@@ -24,6 +24,7 @@
#include <time.h>
#include <sys/uio.h>
+#include "acpid.h"
#include "libnetlink.h"
void rtnl_close(struct rtnl_handle *rth)
--- a/libnetlink.c 2012-07-15 00:29:38.168312376 +0200
+++ b/libnetlink.c 2014-12-28 06:59:17.379705147 +0100
@@ -24,6 +24,7 @@
#include <time.h>
#include <sys/uio.h>
+#include "acpid.h"
#include "libnetlink.h"
void rtnl_close(struct rtnl_handle *rth)
--- a/sock.c 2013-08-15 01:30:44.655673004 +0200
+++ b/sock.c 2014-12-28 07:11:31.198737890 +0100
@@ -53,7 +54,12 @@ int non_root_clients;
int
is_socket(int fd)
{
- return (isfdtype(fd, S_IFSOCK) == 1);
+ struct stat st;
+
+ if (fstat(fd, &st) == 0)
+ return S_ISSOCK(st.st_mode);
+
+ return -1;
}
/* accept a new client connection */