summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--surf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/surf.c b/surf.c
index 7fcd17e..46aef68 100644
--- a/surf.c
+++ b/surf.c
@@ -333,10 +333,11 @@ buildpath(const char *path)
p = (char *)&path[1];
homedir = getcurrentuserhomedir();
} else {
- if ((p = strchr(path, '/')))
+ if ((p = strchr(path, '/'))) {
name = g_strndup(&path[1], --p - path);
- else
+ } else {
name = g_strdup(&path[1]);
+ }
homedir = getuserhomedir(name);
g_free(name);