mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
* utilunix.c (tilde_expand): Fix extra slash in result from tilde_expand() for ~<user>/dir.
This commit is contained in:
parent
ee2e35afb4
commit
8919656440
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user