From b66f41ac8c2c37952680d7e0cba7fd6a269ec3de Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Mon, 14 May 2001 14:41:02 +0000 Subject: use new gethostby* interface --- mdk-stage1/nfsmount.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'mdk-stage1/nfsmount.c') diff --git a/mdk-stage1/nfsmount.c b/mdk-stage1/nfsmount.c index 020d0cdf4..66d09c5f2 100644 --- a/mdk-stage1/nfsmount.c +++ b/mdk-stage1/nfsmount.c @@ -67,9 +67,8 @@ #include "linux-2.2/nfs.h" #include "linux-2.2/nfs_mount.h" //#include "mount_constants.h" - -#include "dns.h" #include "log.h" +#include "dns.h" #include "nfsmount.h" @@ -151,11 +150,13 @@ int nfsmount_prepare(const char *spec, int *flags, char **mount_opts) /* first, try as IP address */ if (!inet_aton(hostname, &server_addr.sin_addr)) { /* failure, try as machine name */ - if (mygethostbyname(hostname, &server_addr.sin_addr)) { - log_message("nfsmount: can't get address for %s", hostname); - goto fail; + struct hostent * host; + host = mygethostbyname(hostname); + if (host && host->h_addr_list && (host->h_addr_list)[0]) { + server_addr.sin_addr = *((struct in_addr *) (host->h_addr_list)[0]); + log_message("is-at: %s", inet_ntoa(server_addr.sin_addr)); } else - server_addr.sin_family = AF_INET; + goto fail; } memcpy (&mount_server_addr, &server_addr, sizeof (mount_server_addr)); -- cgit v1.2.1