summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/libconfuse/files/0001-only-apply-search-path-logic-to-relative-pathnames.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-oe/recipes-support/libconfuse/files/0001-only-apply-search-path-logic-to-relative-pathnames.patch')
-rw-r--r--meta-oe/recipes-support/libconfuse/files/0001-only-apply-search-path-logic-to-relative-pathnames.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/libconfuse/files/0001-only-apply-search-path-logic-to-relative-pathnames.patch b/meta-oe/recipes-support/libconfuse/files/0001-only-apply-search-path-logic-to-relative-pathnames.patch
new file mode 100644
index 0000000000..aa9fab86e6
--- /dev/null
+++ b/meta-oe/recipes-support/libconfuse/files/0001-only-apply-search-path-logic-to-relative-pathnames.patch
@@ -0,0 +1,48 @@
1From b684f4cc25821b6e86a58576f864e4b12dfdfecc Mon Sep 17 00:00:00 2001
2From: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
3Date: Sat, 5 Jun 2021 22:57:51 +0200
4Subject: [PATCH] only apply search path logic to relative pathnames
5
6Adding any directory to the search path via cfg_add_searchpath breaks
7lookup of absolute paths. So change the logic in cfg_searchpath() to
8ignore the search path when the given filename is absolute, and merely
9check that for existence.
10
11This is technically an ABI change, but the current behaviour is quite
12unusual and unexpected.
13
14Upstream-Status: Backport [https://github.com/libconfuse/libconfuse/pull/155]
15
16Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
17---
18 src/confuse.c | 8 ++++++++
19 1 file changed, 8 insertions(+)
20
21diff --git a/src/confuse.c b/src/confuse.c
22index 2ea0254..19b56e3 100644
23--- a/src/confuse.c
24+++ b/src/confuse.c
25@@ -1746,12 +1746,20 @@ DLLIMPORT char *cfg_searchpath(cfg_searchpath_t *p, const char *file)
26 return NULL;
27 }
28
29+ if (file[0] == '/') {
30+ fullpath = strdup(file);
31+ if (!fullpath)
32+ return NULL;
33+ goto check;
34+ }
35+
36 if ((fullpath = cfg_searchpath(p->next, file)) != NULL)
37 return fullpath;
38
39 if ((fullpath = cfg_make_fullpath(p->dir, file)) == NULL)
40 return NULL;
41
42+check:
43 #ifdef HAVE_SYS_STAT_H
44 err = stat((const char *)fullpath, &st);
45 if ((!err) && S_ISREG(st.st_mode))
46--
472.31.1
48