void-packages/srcpkgs/udptunnel/patches/rpc.patch
Đoàn Trần Công Danh 5769f150de srcpkgs/u*: 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

54 lines
1.5 KiB
Diff

# reason: rpcsvc/ypclnt.h is only present in glibc, so check for it
--- a/configure.in
+++ b/configure.in
@@ -19,6 +19,7 @@
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h)
+AC_CHECK_HEADERS(rpcsvc/ypclnt.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_SIZEOF(short)
--- a/host2ip.c
+++ b/host2ip.c
@@ -4,7 +4,9 @@
#include <netdb.h> /* gethostbyname() */
#include <netinet/in.h> /* sockaddr_in */
#include <arpa/inet.h> /* inet_addr() */
+#ifdef HAVE_RPCSVC_YPCLNT_H
#include <rpcsvc/ypclnt.h> /* YP */
+#endif
#include <ctype.h> /* isspace() */
#include <string.h> /* strlen() */
@@ -27,6 +29,8 @@
while (*host && isspace((int)*host)) host++;
}
+ /* pre-set */
+ in.s_addr = INADDR_ANY;
/* Check whether this is a dotted decimal. */
if (!host) {
in.s_addr = INADDR_ANY;
@@ -38,6 +42,7 @@
else if ((hep = gethostbyname(host))) {
in = *(struct in_addr *)(hep->h_addr_list[0]);
}
+#ifdef HAVE_RPCSVC_YPCLNT_H && USE_NIS
/* As a last resort, try YP. */
else {
static char *domain = 0; /* YP domain */
@@ -47,10 +52,8 @@
if (!domain) yp_get_default_domain(&domain);
if (yp_match(domain, "hosts.byname", host, strlen(host), &value, &value_len) == 0) {
in.s_addr = inet_addr(value);
- } else {
- /* Everything failed */
- in.s_addr = INADDR_ANY;
}
}
+#endif
return in;
} /* host2ip */