From 27420dbbd20809381b154ebc237d4e8dbcf4d1d4 Mon Sep 17 00:00:00 2001 From: André Draszik Date: Mon, 28 Nov 2016 09:31:30 +0000 Subject: trousers: fix musl compilation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport patches to fix compilation. Signed-off-by: André Draszik Signed-off-by: Armin Kuster Signed-off-by: Armin Kuster --- ...t-getpwent_r-is-available-before-using-it.patch | 85 ++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 recipes-tpm/trousers/files/0001-Check-that-getpwent_r-is-available-before-using-it.patch (limited to 'recipes-tpm/trousers/files/0001-Check-that-getpwent_r-is-available-before-using-it.patch') diff --git a/recipes-tpm/trousers/files/0001-Check-that-getpwent_r-is-available-before-using-it.patch b/recipes-tpm/trousers/files/0001-Check-that-getpwent_r-is-available-before-using-it.patch new file mode 100644 index 0000000..e7ba2eb --- /dev/null +++ b/recipes-tpm/trousers/files/0001-Check-that-getpwent_r-is-available-before-using-it.patch @@ -0,0 +1,85 @@ +From bb721b0ae5882992037153e7257791101172556e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?No=C3=A9=20Rubinstein?= +Date: Wed, 24 Aug 2016 18:55:25 +0200 +Subject: [PATCH] Check that getpwent_r is available before using it +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This fixes building trousers with musl + +Signed-off-by: Noé Rubinstein +--- +Upstream-Status: Inappropriate [not author https://git.busybox.net/buildroot/plain/package/trousers/0004-Check-that-getpwent_r-is-available-before-using-it.patch] +Signed-off-by: André Draszik + configure.in | 4 ++++ + src/tspi/ps/tspps.c | 10 +++++----- + 2 files changed, 9 insertions(+), 5 deletions(-) + +diff --git a/configure.in b/configure.in +index add23dc..cfdfcaa 100644 +--- a/configure.in ++++ b/configure.in +@@ -144,6 +144,10 @@ else + AC_MSG_ERROR(["gtk", "openssl" and "none" are the only supported gui options for trousers]) + fi + ++# Look for getpwent_r. If it is not found, getpwent will be used instead, with ++# an additional mutex. ++AC_CHECK_FUNC(getpwent_r, [AC_DEFINE(HAVE_GETPWENT_R)]) ++ + # + # The default port that the TCS daemon listens on + # +diff --git a/src/tspi/ps/tspps.c b/src/tspi/ps/tspps.c +index c6f9c3d..9d00d2a 100644 +--- a/src/tspi/ps/tspps.c ++++ b/src/tspi/ps/tspps.c +@@ -45,7 +45,7 @@ + + static int user_ps_fd = -1; + static MUTEX_DECLARE_INIT(user_ps_lock); +-#if (defined (__FreeBSD__) || defined (__OpenBSD__)) ++#ifndef HAVE_GETPWENT_R + static MUTEX_DECLARE_INIT(user_ps_path); + #endif + static struct flock fl; +@@ -60,7 +60,7 @@ get_user_ps_path(char **file) + TSS_RESULT result; + char *file_name = NULL, *home_dir = NULL; + struct passwd *pwp; +-#if (defined (__linux) || defined (linux) || defined(__GLIBC__)) ++#ifdef HAVE_GETPWENT_R + struct passwd pw; + #endif + struct stat stat_buf; +@@ -72,7 +72,7 @@ get_user_ps_path(char **file) + *file = strdup(file_name); + return (*file) ? TSS_SUCCESS : TSPERR(TSS_E_OUTOFMEMORY); + } +-#if (defined (__FreeBSD__) || defined (__OpenBSD__)) ++#ifndef HAVE_GETPWENT_R + MUTEX_LOCK(user_ps_path); + #endif + +@@ -90,7 +90,7 @@ get_user_ps_path(char **file) + #else + setpwent(); + while (1) { +-#if (defined (__linux) || defined (linux) || defined(__GLIBC__)) ++#ifdef HAVE_GETPWENT_R + 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 @@ get_user_ps_path(char **file) + return TSPERR(TSS_E_INTERNAL_ERROR); + } + +-#elif (defined (__FreeBSD__) || defined (__OpenBSD__)) ++#else + if ((pwp = getpwent()) == NULL) { + LogDebugFn("USER PS: Error getting path to home directory: getpwent: %s", + strerror(rc)); +-- +2.10.2 + -- cgit v1.2.3-54-g00ecf