void-packages/srcpkgs/trousers/patches/musl-getpwent_r.patch
Đoàn Trần Công Danh 4f75cf25fd srcpkgs/t*: 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

47 lines
1.4 KiB
Diff

--- a/src/tspi/ps/tspps.c 2015-11-18 12:45:47.585113542 +0100
+++ b/src/tspi/ps/tspps.c 2015-11-18 12:46:37.605577956 +0100
@@ -45,7 +45,7 @@
static int user_ps_fd = -1;
static MUTEX_DECLARE_INIT(user_ps_lock);
-#if (defined (__FreeBSD__) || defined (__OpenBSD__))
+#if !defined(__GLIBC__)
static MUTEX_DECLARE_INIT(user_ps_path);
#endif
static struct flock fl;
@@ -60,7 +60,7 @@
TSS_RESULT result;
char *file_name = NULL, *home_dir = NULL;
struct passwd *pwp;
-#if (defined (__linux) || defined (linux) || defined(__GLIBC__))
+#if defined(__GLIBC__)
struct passwd pw;
#endif
struct stat stat_buf;
@@ -72,7 +72,7 @@
*file = strdup(file_name);
return (*file) ? TSS_SUCCESS : TSPERR(TSS_E_OUTOFMEMORY);
}
-#if (defined (__FreeBSD__) || defined (__OpenBSD__))
+#if !defined(__GLIBC__)
MUTEX_LOCK(user_ps_path);
#endif
@@ -90,7 +90,7 @@
#else
setpwent();
while (1) {
-#if (defined (__linux) || defined (linux) || defined(__GLIBC__))
+#if defined(__GLIBC__)
rc = getpwent_r(&pw, buf, PASSWD_BUFSIZE, &pwp);
if (rc) {
LogDebugFn("USER PS: Error getting path to home directory: getpwent_r: %s",
@@ -99,7 +99,7 @@
return TSPERR(TSS_E_INTERNAL_ERROR);
}
-#elif (defined (__FreeBSD__) || defined (__OpenBSD__))
+#elif !defined(__GLIBC__)
if ((pwp = getpwent()) == NULL) {
LogDebugFn("USER PS: Error getting path to home directory: getpwent: %s",
strerror(rc));