From 89196564401bd64bbcbb852f2714467bb0b09ea8 Mon Sep 17 00:00:00 2001 From: "Andrew V. Samoilov" Date: Tue, 14 Sep 2004 17:23:16 +0000 Subject: [PATCH] * utilunix.c (tilde_expand): Fix extra slash in result from tilde_expand() for ~/dir. --- src/utilunix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utilunix.c b/src/utilunix.c index d2e8e95f9..ca0b64e8f 100644 --- a/src/utilunix.c +++ b/src/utilunix.c @@ -270,18 +270,18 @@ tilde_expand (const char *directory) p = directory + 1; - q = strchr (p, PATH_SEP); - /* d = "~" or d = "~/" */ if (!(*p) || (*p == PATH_SEP)) { passwd = getpwuid (geteuid ()); q = (*p == PATH_SEP) ? p + 1 : ""; } else { + q = strchr (p, PATH_SEP); if (!q) { passwd = getpwnam (p); } else { name = g_strndup (p, q - p); passwd = getpwnam (name); + q++; g_free (name); } }