diff options
author | Guillaume Cottenceau <gc@mandriva.com> | 2001-05-14 14:41:02 +0000 |
---|---|---|
committer | Guillaume Cottenceau <gc@mandriva.com> | 2001-05-14 14:41:02 +0000 |
commit | b66f41ac8c2c37952680d7e0cba7fd6a269ec3de (patch) | |
tree | 17321f54bbe00e178b229d4b486292fb49383972 | |
parent | 17081323f1560596df0f8adc78fd30939e14fad2 (diff) | |
download | drakx-b66f41ac8c2c37952680d7e0cba7fd6a269ec3de.tar drakx-b66f41ac8c2c37952680d7e0cba7fd6a269ec3de.tar.gz drakx-b66f41ac8c2c37952680d7e0cba7fd6a269ec3de.tar.bz2 drakx-b66f41ac8c2c37952680d7e0cba7fd6a269ec3de.tar.xz drakx-b66f41ac8c2c37952680d7e0cba7fd6a269ec3de.zip |
use new gethostby* interface
-rw-r--r-- | mdk-stage1/nfsmount.c | 13 |
1 files changed, 7 insertions, 6 deletions
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)); |