summaryrefslogtreecommitdiffstats
path: root/loader2/urls.c
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2006-07-31 16:36:54 +0000
committerDavid Cantrell <dcantrell@redhat.com>2006-07-31 16:36:54 +0000
commit6c138a2a8ca7abad3cabf07110fa2c76642ee97b (patch)
treed7402e0a92f8d302993f8f00713b9065b4495b4c /loader2/urls.c
parent56b8af361f5875d675c4ee1ecdf7f23311462ef1 (diff)
downloadanaconda-6c138a2a8ca7abad3cabf07110fa2c76642ee97b.tar.gz
anaconda-6c138a2a8ca7abad3cabf07110fa2c76642ee97b.tar.xz
anaconda-6c138a2a8ca7abad3cabf07110fa2c76642ee97b.zip
* loader2/ftp.c (getHostAddress): Use mygethostbyname().
* loader2/urls.c (addrToIp): Use mygethostbyname(). * loader2/urls.c (urlinstStartTransfer): Use mygethostbyname() to try and determine host address family before calling ftpOpen() or httpGetFileDesc().
Diffstat (limited to 'loader2/urls.c')
-rw-r--r--loader2/urls.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/loader2/urls.c b/loader2/urls.c
index ad76683f4..c4ab5d882 100644
--- a/loader2/urls.c
+++ b/loader2/urls.c
@@ -179,9 +179,15 @@ int urlinstStartTransfer(struct iurlinfo * ui, char * filename,
family = AF_INET;
else if (inet_pton(AF_INET6, ui->address, &addr6) >= 1)
family = AF_INET6;
- else
- logMessage(ERROR, "cannot determine address family of %s",
- ui->address);
+ else {
+ /* FIXME: mygethostbyname sure needs to support IPv6 */
+ if (mygethostbyname(ui->address, &addr) == 0) {
+ family = AF_INET;
+ } else {
+ logMessage(ERROR, "cannot determine address family of %s",
+ ui->address);
+ }
+ }
if (ui->protocol == URL_METHOD_FTP) {
ui->ftpPort = ftpOpen(ui->address, family,
@@ -235,18 +241,13 @@ int urlinstFinishTransfer(struct iurlinfo * ui, int fd) {
}
char * addrToIp(char * hostname) {
- struct hostent *he;
struct in_addr ad;
struct in6_addr ad6;
char *ret;
- he = gethostbyname2(hostname, AF_INET);
- if (he)
- return he->h_name;
-
- he = gethostbyname2(hostname, AF_INET6);
- if (he)
- return he->h_name;
+ /* FIXME: mygethostbyname needs to support IPv6 */
+ if (mygethostbyname(hostname, &ad))
+ return NULL;
if ((ret = malloc(48)) == NULL)
return hostname;