summaryrefslogtreecommitdiffstats
path: root/loader2
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2006-08-04 18:02:12 +0000
committerChris Lumens <clumens@redhat.com>2006-08-04 18:02:12 +0000
commit7fac35253bae23a3a95b579462ac24ce778246d0 (patch)
treeb6f637bb6cbe8b1a6f244e38a182a4d5bd879329 /loader2
parent43d981520ce3880e79ecbcb3f656b3f24ba3df0e (diff)
downloadanaconda-7fac35253bae23a3a95b579462ac24ce778246d0.tar.gz
anaconda-7fac35253bae23a3a95b579462ac24ce778246d0.tar.xz
anaconda-7fac35253bae23a3a95b579462ac24ce778246d0.zip
Fix traceback when trying to add a leading slash to paths without one
(#197403, #201243, #201367).
Diffstat (limited to 'loader2')
-rw-r--r--loader2/urls.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/loader2/urls.c b/loader2/urls.c
index c7475db9d..21be24063 100644
--- a/loader2/urls.c
+++ b/loader2/urls.c
@@ -384,17 +384,10 @@ int urlMainSetupPanel(struct iurlinfo * ui, urlprotocol protocol,
if (ui->prefix) free(ui->prefix);
/* add a slash at the start of the dir if it is missing */
- if (*dir != '/') {
- if ((buf = realloc(buf, strlen(dir) + 2)) == NULL) {
- buf = strdup(dir); /* try dir anyway */
- } else {
- sprintf(buf, "/%s", dir);
- }
- ui->prefix = strdup(buf);
- free(buf);
- } else {
+ if (*dir != '/')
+ asprintf(&(ui->prefix), "/%s", dir);
+ else
ui->prefix = strdup(dir);
- }
/* Get rid of trailing /'s */
chptr = ui->prefix + strlen(ui->prefix) - 1;