void-packages/srcpkgs/trousers/patches/musl-getpwent_r.patch
2016-01-07 23:13:15 -05:00

47 lines
1.4 KiB
Diff

--- src/tspi/ps/tspps.c.orig 2015-11-18 12:45:47.585113542 +0100
+++ 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));