summaryrefslogtreecommitdiffstats
path: root/loader2/urls.c
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2006-11-02 02:20:24 +0000
committerDavid Cantrell <dcantrell@redhat.com>2006-11-02 02:20:24 +0000
commitc89579246f19348d5921e6148b235bf840b24f88 (patch)
treeae6e06ac2a1b98d7e911e5c8ed4a7013fcbaf245 /loader2/urls.c
parentbf05f4da7b9d4e83095a633eef2ef759ded9499b (diff)
downloadanaconda-c89579246f19348d5921e6148b235bf840b24f88.tar.gz
anaconda-c89579246f19348d5921e6148b235bf840b24f88.tar.xz
anaconda-c89579246f19348d5921e6148b235bf840b24f88.zip
Added IPv6 DNS lookup support to libisys.
Diffstat (limited to 'loader2/urls.c')
-rw-r--r--loader2/urls.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/loader2/urls.c b/loader2/urls.c
index fbf297ad7..9cdd31059 100644
--- a/loader2/urls.c
+++ b/loader2/urls.c
@@ -187,12 +187,10 @@ int urlinstStartTransfer(struct iurlinfo * ui, char * filename,
else if (inet_pton(AF_INET6, hostname, &addr6) >= 1)
family = AF_INET6;
else {
- if (mygethostbyname(hostname, &addr) == 0) {
+ if (mygethostbyname(hostname, &addr, AF_INET) == 0) {
family = AF_INET;
-/*
- } else if (mygethostbyname(hostname, &addr6) == 0) {
+ } else if (mygethostbyname(hostname, &addr6, AF_INET6) == 0) {
family = AF_INET6;
-*/
} else {
logMessage(ERROR, "cannot determine address family of %s",
hostname);
@@ -248,7 +246,9 @@ char * addrToIp(char * hostname) {
return ret;
else if (inet_ntop(AF_INET6, &ad6, ret, INET6_ADDRSTRLEN) != NULL)
return ret;
- else if (mygethostbyname(hostname, &ad) == 0)
+ else if (mygethostbyname(hostname, &ad, AF_INET) == 0)
+ return hostname;
+ else if (mygethostbyname(hostname, &ad6, AF_INET6) == 0)
return hostname;
else
return NULL;
@@ -377,10 +377,12 @@ 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 != '/')
- asprintf(&(ui->prefix), "/%s", dir);
- else
+ if (*dir != '/') {
+ if (asprintf(&(ui->prefix), "/%s", dir) == -1)
+ ui->prefix = strdup(dir);
+ } else {
ui->prefix = strdup(dir);
+ }
/* Get rid of trailing /'s */
chptr = ui->prefix + strlen(ui->prefix) - 1;