From 496c7d3e18e076959ab50201ce95e5b82e8903f6 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sat, 25 Feb 2012 08:42:00 +0100 Subject: [PATCH] core: fix expand of path "~" to home of user in function string_expand_home ("~/xxx" was ok, but not "~") --- ChangeLog | 4 +++- src/core/wee-string.c | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 75ce2eddb..40c5d9151 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,12 +1,14 @@ WeeChat ChangeLog ================= Sébastien Helleu -v0.3.7-rc3, 2012-02-20 +v0.3.7-rc3, 2012-02-25 Version 0.3.7 (under dev!) -------------------------- +* core: fix expand of path "~" to home of user in function string_expand_home + ("~/xxx" was ok, but not "~") * core: fix memory leak when closing buffer * core: fix memory leak in function util_search_full_lib_name * core: automatically add newline char after last pasted line (when pasting many diff --git a/src/core/wee-string.c b/src/core/wee-string.c index 885d88ec8..1d16d6d0f 100644 --- a/src/core/wee-string.c +++ b/src/core/wee-string.c @@ -476,8 +476,11 @@ string_expand_home (const char *path) if (!path) return NULL; - if (!path[0] || (path[0] != '~') || (path[1] != DIR_SEPARATOR_CHAR)) + if (!path[0] || (path[0] != '~') + || ((path[1] && path[1] != DIR_SEPARATOR_CHAR))) + { return strdup (path); + } ptr_home = getenv ("HOME");