Mercurial > gftp.yaz
diff lib/misc.c @ 247:f41650dc896c
2003-8-6 Brian Masney <masneyb@gftp.org>
* lib/misc.c (gftp_build_path) - fixed initial path beginning with //.
(expand_path) - when the path is empty at the end, set it to /. This
would happen for directories like /etc/..
author | masneyb |
---|---|
date | Wed, 06 Aug 2003 20:31:34 +0000 |
parents | 41af60bc1f88 |
children | 094e83b55cb1 |
line wrap: on
line diff
--- a/lib/misc.c Tue Aug 05 01:54:03 2003 +0000 +++ b/lib/misc.c Wed Aug 06 20:31:34 2003 +0000 @@ -195,7 +195,7 @@ if (newstr != NULL) g_free (newstr); - newstr = g_malloc0 (1); + newstr = g_strdup ("/"); } g_free (str); @@ -205,7 +205,7 @@ if ((pos = strchr (newstr, '/')) == NULL) str = g_strdup (pw->pw_dir); else - str = g_strconcat (pw->pw_dir, pos, NULL); + str = gftp_build_path (pw->pw_dir, pos, NULL); g_free (newstr); newstr = str; @@ -1203,11 +1203,11 @@ g_return_val_if_fail (first_element != NULL, NULL); - ret = g_malloc0 (1); - retlen = 0; + ret = g_strdup (first_element); + retlen = strlen (ret); va_start (args, first_element); - for (element = first_element; + for (element = va_arg (args, char *); element != NULL; element = va_arg (args, char *)) {