From 41ae68f2986709daecd1b00a91919df8b2d9581f Mon Sep 17 00:00:00 2001 From: Marc Dionne Date: Sat, 16 Jan 2010 18:57:24 -0500 Subject: [PATCH] uss: Fix IP address parsing and cleanup warnings In uss_vol_GetServer(), the IP address octets are scanned into "char" variables, and later cast to afs_int32 to build the address. sscanf gives warnings because it's expecting an int pointer, and testing shows that this code doesn't work as expected - the first 3 octets are always parsed as 0. Use afs_int32 variables instead, which works, eliminates warnings and simplifies the code. Note that this code does not seem to be reachable currently. It was probably meant to be used by planned additional uss commands. Change-Id: I646d4cbfa8ac0d0c50f98a334ac3fe387d6d361b Reviewed-on: http://gerrit.openafs.org/1119 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/uss/uss_vol.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/uss/uss_vol.c b/src/uss/uss_vol.c index 1bcd85c68..ccc21c2de 100644 --- a/src/uss/uss_vol.c +++ b/src/uss/uss_vol.c @@ -371,7 +371,7 @@ uss_vol_GetServer(char *a_name) register struct hostent *th; afs_int32 addr; - char b1, b2, b3, b4; + afs_int32 b1, b2, b3, b4; register afs_int32 code; code = sscanf(a_name, "%d.%d.%d.%d", &b1, &b2, &b3, &b4); @@ -380,9 +380,7 @@ uss_vol_GetServer(char *a_name) * Parsed as 128.2.9.4, or similar; return it in network * byte order (128 in byte 0). */ - addr = - (((afs_int32) b1) << 24) | (((afs_int32) b2) << 16) | - (((afs_int32) b3) << 8) | (afs_int32) b4; + addr = (b1 << 24) | (b2 << 16) | (b3 << 8) | b4; return htonl(addr); } -- 2.39.5