aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuis Ressel <aranea@aixah.de>2019-01-10 17:54:46 +0100
committerAnthony G. Basile <blueness@gentoo.org>2019-01-11 10:09:35 -0500
commitd8ac254024baa255a225d915ce28b48dbd339985 (patch)
tree08b9bff8eb77654bef6c0b35629ea8659f36584d /x11-misc
parentImport x11-libs/i3status from ::gentoo (diff)
downloadmusl-d8ac254024baa255a225d915ce28b48dbd339985.tar.gz
musl-d8ac254024baa255a225d915ce28b48dbd339985.tar.bz2
musl-d8ac254024baa255a225d915ce28b48dbd339985.zip
Patch i3status to remove uses of GLOB_TILDE
* Reimplement resolve_tilde(). The new impl isn't quite equivalent, but since this function is only used internally, I don't see why using glob() would be neccessary. * Define GLOB_TILDE=0 to fix the other two sites which use it. They process user-provided paths and only use GLOB_TILDE for convenience, so it can be disabled. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'x11-misc')
-rw-r--r--x11-misc/i3status/files/i3status-2.12-glob_tilde.patch59
-rw-r--r--x11-misc/i3status/i3status-2.12.ebuild2
2 files changed, 60 insertions, 1 deletions
diff --git a/x11-misc/i3status/files/i3status-2.12-glob_tilde.patch b/x11-misc/i3status/files/i3status-2.12-glob_tilde.patch
new file mode 100644
index 0000000..b1f2ba6
--- /dev/null
+++ b/x11-misc/i3status/files/i3status-2.12-glob_tilde.patch
@@ -0,0 +1,59 @@
+diff --git i/i3status.c w/i3status.c
+index 5088c96..3c18214 100644
+--- i/i3status.c
++++ w/i3status.c
+@@ -210,29 +210,19 @@ static int valid_color(const char *value) {
+ *
+ */
+ static char *resolve_tilde(const char *path) {
+- static glob_t globbuf;
+- char *head, *tail, *result = NULL;
+-
+- tail = strchr(path, '/');
+- head = strndup(path, tail ? (size_t)(tail - path) : strlen(path));
+-
+- int res = glob(head, GLOB_TILDE, NULL, &globbuf);
+- free(head);
+- /* no match, or many wildcard matches are bad */
+- if (res == GLOB_NOMATCH || globbuf.gl_pathc != 1)
+- result = sstrdup(path);
+- else if (res != 0) {
+- die("glob() failed");
+- } else {
+- head = globbuf.gl_pathv[0];
+- result = scalloc(strlen(head) + (tail ? strlen(tail) : 0) + 1);
+- strncpy(result, head, strlen(head));
+- if (tail)
+- strncat(result, tail, strlen(tail));
++ char *home, *result = NULL;
++
++ if (strncmp(path, "~/", 2) == 0) {
++ home = getenv("HOME");
++ if (home != NULL) {
++ result = scalloc(strlen(home) + strlen(path));
++ strcpy(result, home);
++ strcat(result, path+1);
++ return result;
++ }
+ }
+- globfree(&globbuf);
+
+- return result;
++ return sstrdup(path);
+ }
+
+ static char *get_config_path(void) {
+diff --git i/include/i3status.h w/include/i3status.h
+index 9ac471d..27ecae4 100644
+--- i/include/i3status.h
++++ w/include/i3status.h
+@@ -236,4 +236,9 @@ extern cfg_t *cfg, *cfg_general, *cfg_section;
+ extern void **cur_instance;
+
+ extern pthread_t main_thread;
++
++#ifndef GLOB_TILDE
++#define GLOB_TILDE 0
++#endif
++
+ #endif
diff --git a/x11-misc/i3status/i3status-2.12.ebuild b/x11-misc/i3status/i3status-2.12.ebuild
index 81f9ba7..2d8020a 100644
--- a/x11-misc/i3status/i3status-2.12.ebuild
+++ b/x11-misc/i3status/i3status-2.12.ebuild
@@ -24,7 +24,7 @@ DEPEND="
"
RDEPEND="${DEPEND}"
-PATCHES=( "${FILESDIR}"/${PN}-2.11-pulseaudio.patch )
+PATCHES=( "${FILESDIR}"/${PN}-2.11-pulseaudio.patch "${FILESDIR}"/${PN}-2.12-glob_tilde.patch )
src_prepare() {
default