summaryrefslogtreecommitdiff
path: root/system/pkgconf/personality.patch
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-03-08 04:29:08 +0000
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-03-08 04:29:08 +0000
commit00042447f4a5a5ea733ca66ad59a10c32db24287 (patch)
treefd23133509a5b1740268979846027c6a35a852a5 /system/pkgconf/personality.patch
parentb053440732ce017bb82363b66b00d5b36a046ece (diff)
downloadpackages-00042447f4a5a5ea733ca66ad59a10c32db24287.tar.gz
packages-00042447f4a5a5ea733ca66ad59a10c32db24287.tar.bz2
packages-00042447f4a5a5ea733ca66ad59a10c32db24287.tar.xz
packages-00042447f4a5a5ea733ca66ad59a10c32db24287.zip
system/pkgconf: bump to 1.6.0, modernise
Diffstat (limited to 'system/pkgconf/personality.patch')
-rw-r--r--system/pkgconf/personality.patch55
1 files changed, 55 insertions, 0 deletions
diff --git a/system/pkgconf/personality.patch b/system/pkgconf/personality.patch
new file mode 100644
index 000000000..e7ff9ad9a
--- /dev/null
+++ b/system/pkgconf/personality.patch
@@ -0,0 +1,55 @@
+From d926e75b345a6948e4e976828d3331cd7f0db660 Mon Sep 17 00:00:00 2001
+From: Emil Renner Berthing <esmil@mailme.dk>
+Date: Wed, 6 Mar 2019 16:03:32 +0100
+Subject: [PATCH] main: fix personalities when argv[0] contains path
+
+---
+ cli/main.c | 31 ++++++++++++++++++++-----------
+ 1 file changed, 20 insertions(+), 11 deletions(-)
+
+diff --git a/cli/main.c b/cli/main.c
+index b52cc85..caa2525 100644
+--- a/cli/main.c
++++ b/cli/main.c
+@@ -740,21 +740,30 @@ dump_personality(const pkgconf_cross_personality_t *p)
+ static pkgconf_cross_personality_t *
+ deduce_personality(char *argv[])
+ {
+- char *workbuf = strdup(argv[0]), *i;
+- pkgconf_cross_personality_t *out = pkgconf_cross_personality_default(), *deduced;
++ const char *argv0 = argv[0];
++ char *i, *prefix;
++ pkgconf_cross_personality_t *out;
++
++ i = strrchr(argv0, '/');
++ if (i != NULL)
++ argv0 = i + 1;
++
++#if defined(_WIN32) || defined(_WIN64)
++ i = strrchr(argv0, '\\');
++ if (i != NULL)
++ argv0 = i + 1;
++#endif
+
+- i = strstr(workbuf, "-pkg");
++ i = strstr(argv0, "-pkg");
+ if (i == NULL)
+- goto finish;
+-
+- *i = 0;
++ return pkgconf_cross_personality_default();
+
+- deduced = pkgconf_cross_personality_find(workbuf);
+- if (deduced != NULL)
+- out = deduced;
++ prefix = strndup(argv0, i - argv0);
++ out = pkgconf_cross_personality_find(prefix);
++ free(prefix);
++ if (out == NULL)
++ return pkgconf_cross_personality_default();
+
+-finish:
+- free(workbuf);
+ return out;
+ }
+