summaryrefslogtreecommitdiff
path: root/user/i3status/glob_tilde.patch
diff options
context:
space:
mode:
Diffstat (limited to 'user/i3status/glob_tilde.patch')
-rw-r--r--user/i3status/glob_tilde.patch38
1 files changed, 22 insertions, 16 deletions
diff --git a/user/i3status/glob_tilde.patch b/user/i3status/glob_tilde.patch
index b1f2ba667..87177d78e 100644
--- a/user/i3status/glob_tilde.patch
+++ b/user/i3status/glob_tilde.patch
@@ -1,8 +1,14 @@
-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) {
+diff --git a/i3status.c b/i3status.c
+index 0898da3..f4b10fd 100644
+--- a/i3status.c
++++ b/i3status.c
+@@ -207,35 +207,23 @@ static int valid_color(const char *value) {
+
+ /*
+ * This function resolves ~ in pathnames.
+- * It may resolve wildcards in the first part of the path, but if no match
+- * or multiple matches are found, it just returns a copy of path as given.
++ * The syntax '~user' is not supported.
*
*/
static char *resolve_tilde(const char *path) {
@@ -22,19 +28,19 @@ index 5088c96..3c18214 100644
- } 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));
+- strcpy(result, head);
+- if (tail) {
+- strcat(result, tail);
+ char *home, *result = NULL;
+
-+ if (strncmp(path, "~/", 2) == 0) {
++ if (path[0] == '~' && (path[1] == '/' || path[1] == '\0')) {
+ home = getenv("HOME");
+ if (home != NULL) {
+ result = scalloc(strlen(home) + strlen(path));
+ strcpy(result, home);
-+ strcat(result, path+1);
++ strcat(result, path + 1);
+ return result;
-+ }
+ }
}
- globfree(&globbuf);
@@ -43,11 +49,11 @@ index 5088c96..3c18214 100644
}
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;
+diff --git a/include/i3status.h b/include/i3status.h
+index 217376a..34e44a0 100644
+--- a/include/i3status.h
++++ b/include/i3status.h
+@@ -241,4 +241,9 @@ extern cfg_t *cfg, *cfg_general, *cfg_section;
extern void **cur_instance;
extern pthread_t main_thread;