diff options
author | Chris Lumens <clumens@redhat.com> | 2006-08-04 18:02:12 +0000 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2006-08-04 18:02:12 +0000 |
commit | 7fac35253bae23a3a95b579462ac24ce778246d0 (patch) | |
tree | b6f637bb6cbe8b1a6f244e38a182a4d5bd879329 | |
parent | 43d981520ce3880e79ecbcb3f656b3f24ba3df0e (diff) | |
download | anaconda-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).
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | loader2/urls.c | 13 |
2 files changed, 8 insertions, 10 deletions
@@ -1,3 +1,8 @@ +2006-08-04 Chris Lumens <clumens@redhat.com> + + * loader2/urls.c (urlMainSetupPanel): Fix traceback when trying to + add a leading slash to paths without one (#197403, #201243, #201367). + 2006-08-03 Peter Jones <pjones@redhat.com> * gui.py (ProgressWindow): Make a timeout after which we update the 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; |