mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 18:14:25 +03:00
(mc_build_filename): fixed incorrect processing of empty paths.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
b61e0fc6a9
commit
b63eea10cb
@ -1019,23 +1019,28 @@ mc_build_filename (const char *first_element, ...)
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
char *tmp_element;
|
if (*element == '\0')
|
||||||
size_t len;
|
element = va_arg (args, char *);
|
||||||
const char *start;
|
else
|
||||||
|
{
|
||||||
|
char *tmp_element;
|
||||||
|
size_t len;
|
||||||
|
const char *start;
|
||||||
|
|
||||||
tmp_element = g_strdup (element);
|
tmp_element = g_strdup (element);
|
||||||
|
|
||||||
element = va_arg (args, char *);
|
element = va_arg (args, char *);
|
||||||
|
|
||||||
canonicalize_pathname (tmp_element);
|
canonicalize_pathname (tmp_element);
|
||||||
len = strlen (tmp_element);
|
len = strlen (tmp_element);
|
||||||
start = (tmp_element[0] == PATH_SEP) ? tmp_element + 1 : tmp_element;
|
start = (tmp_element[0] == PATH_SEP) ? tmp_element + 1 : tmp_element;
|
||||||
|
|
||||||
g_string_append (path, start);
|
g_string_append (path, start);
|
||||||
if (tmp_element[len - 1] != PATH_SEP && element != NULL)
|
if (tmp_element[len - 1] != PATH_SEP && element != NULL)
|
||||||
g_string_append_c (path, PATH_SEP);
|
g_string_append_c (path, PATH_SEP);
|
||||||
|
|
||||||
g_free (tmp_element);
|
g_free (tmp_element);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while (element != NULL);
|
while (element != NULL);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user