ports/security/gnupg/files/patch-common_homedir.c
Adriaan de Groot 7f3f8384a6 security/gnupg: fix table / enum mismatch
PR259775 reports that (auto)configuration behaves weirdly.
This is caused by a mismatch between an enum in the code
and a table that expects to match the enum values. When
BUILD_WITH_TPM2D is off (the default; I have not looked if
it can even be turned on in ports) one table entry is

Patch also submitted upstream.

PR:		259775
Reported by:	O. Hartmann
MFH:		2021Q3
2021-11-22 10:18:08 +01:00

30 lines
1.2 KiB
C

--- common/homedir.c.orig 2021-10-01 12:44:06 UTC
+++ common/homedir.c
@@ -68,7 +68,9 @@
* text was read. */
#if __linux__
# define MYPROC_SELF_EXE "/proc/self/exe"
-#else /* Assume *BSD*/
+#elif defined(__NetBSD__)
+# define MYPROC_SELF_EXE "/proc/curproc/exe"
+#else /* Assume other BSDs */
# define MYPROC_SELF_EXE "/proc/curproc/file"
#endif
@@ -495,13 +497,13 @@ unix_rootdir (int want_sysconfdir)
if (nread < 0)
{
err = gpg_error_from_syserror ();
- log_info ("error reading symlink '%s': %s\n",
- MYPROC_SELF_EXE, gpg_strerror (err));
buffer[0] = 0;
if ((name = getenv ("GNUPG_BUILD_ROOT")) && *name == '/')
{
/* Try a fallback for systems w/o a supported /proc
- * file system. */
+ * file system if we are running a regression test. */
+ log_info ("error reading symlink '%s': %s\n",
+ MYPROC_SELF_EXE, gpg_strerror (err));
xfree (buffer);
buffer = xstrconcat (name, "/bin/gpgconf", NULL);
log_info ("trying fallback '%s'\n", buffer);