aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-02-27 19:38:19 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-02-27 19:38:19 +0100
commit99069330a104e6d360635174be5f5ed054c418b8 (patch)
treef800b70a7b8989db14f5964b65534181d4a1a309 /util-linux
parentca228fb16dddc3c959adad97a930612a6b5256db (diff)
downloadbusybox-w32-99069330a104e6d360635174be5f5ed054c418b8.tar.gz
busybox-w32-99069330a104e6d360635174be5f5ed054c418b8.tar.bz2
busybox-w32-99069330a104e6d360635174be5f5ed054c418b8.zip
*: gethostname-related fixes
function old new delta hostname_main 218 231 +13 nfsmount 3541 3474 -67 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/mount.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 4392363ba..620b14667 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -1043,12 +1043,10 @@ static NOINLINE int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
1043 bb_herror_msg("%s", hostname); 1043 bb_herror_msg("%s", hostname);
1044 goto fail; 1044 goto fail;
1045 } 1045 }
1046 if ((size_t)hp->h_length > sizeof(struct in_addr)) { 1046 if (hp->h_length != (int)sizeof(struct in_addr)) {
1047 bb_error_msg("got bad hp->h_length"); 1047 bb_error_msg_and_die("only IPv4 is supported");
1048 hp->h_length = sizeof(struct in_addr);
1049 } 1048 }
1050 memcpy(&server_addr.sin_addr, 1049 memcpy(&server_addr.sin_addr, hp->h_addr_list[0], sizeof(struct in_addr));
1051 hp->h_addr, hp->h_length);
1052 } 1050 }
1053 1051
1054 memcpy(&mount_server_addr, &server_addr, sizeof(mount_server_addr)); 1052 memcpy(&mount_server_addr, &server_addr, sizeof(mount_server_addr));
@@ -1331,13 +1329,11 @@ static NOINLINE int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
1331 bb_herror_msg("%s", mounthost); 1329 bb_herror_msg("%s", mounthost);
1332 goto fail; 1330 goto fail;
1333 } 1331 }
1334 if ((size_t)hp->h_length > sizeof(struct in_addr)) { 1332 if (hp->h_length != (int)sizeof(struct in_addr)) {
1335 bb_error_msg("got bad hp->h_length"); 1333 bb_error_msg_and_die("only IPv4 is supported");
1336 hp->h_length = sizeof(struct in_addr);
1337 } 1334 }
1338 mount_server_addr.sin_family = AF_INET; 1335 mount_server_addr.sin_family = AF_INET;
1339 memcpy(&mount_server_addr.sin_addr, 1336 memcpy(&mount_server_addr.sin_addr, hp->h_addr_list[0], sizeof(struct in_addr));
1340 hp->h_addr, hp->h_length);
1341 } 1337 }
1342 } 1338 }
1343 1339