summaryrefslogtreecommitdiff
path: root/app-editors/zile/files/zile-2.3.24-userhome.patch
diff options
context:
space:
mode:
Diffstat (limited to 'app-editors/zile/files/zile-2.3.24-userhome.patch')
-rw-r--r--app-editors/zile/files/zile-2.3.24-userhome.patch26
1 files changed, 26 insertions, 0 deletions
diff --git a/app-editors/zile/files/zile-2.3.24-userhome.patch b/app-editors/zile/files/zile-2.3.24-userhome.patch
new file mode 100644
index 000000000000..37f605ccf610
--- /dev/null
+++ b/app-editors/zile/files/zile-2.3.24-userhome.patch
@@ -0,0 +1,26 @@
+http://lists.gnu.org/archive/html/bug-zile/2011-08/msg00030.html
+
+--- zile-2.3.24-orig/src/file.c
++++ zile-2.3.24/src/file.c
+@@ -177,14 +177,15 @@ compact_path (astr path)
+ {
+ /* Replace `/userhome/' (if found) with `~/'. */
+ size_t homelen = strlen (pw->pw_dir);
+- if (astr_len (path) >= homelen &&
+- !strncmp (pw->pw_dir, astr_cstr (path), homelen))
++ if (homelen > 0 && pw->pw_dir[homelen - 1] == '/')
++ homelen--;
++
++ if (astr_len (path) > homelen &&
++ !strncmp (pw->pw_dir, astr_cstr (path), homelen) &&
++ astr_get (path, homelen) == '/')
+ {
+ astr buf = astr_new_cstr ("~/");
+- if (STREQ (pw->pw_dir, "/"))
+- astr_cat_cstr (buf, astr_cstr (path) + 1);
+- else
+- astr_cat_cstr (buf, astr_cstr (path) + homelen + 1);
++ astr_cat_cstr (buf, astr_cstr (path) + homelen + 1);
+ astr_cpy (path, buf);
+ astr_delete (buf);
+ }