From: NeilBrown Date: Wed, 7 Aug 2013 23:16:43 +0000 (+1000) Subject: Create: fix warning about pre-existing filesystems. X-Git-Tag: mdadm-3.3~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2538ba2abf363192f8f737423ca62286a788c723;p=thirdparty%2Fmdadm.git Create: fix warning about pre-existing filesystems. An ext[234] filesystem larger than 2TB was beign reported with a negative size - which looks odd. So fix it to use suitably large and unsigned values. Reported-by: Jan Engelhardt Signed-off-by: NeilBrown --- diff --git a/util.c b/util.c index e7e3d488..8096e297 100644 --- a/util.c +++ b/util.c @@ -511,7 +511,8 @@ int check_ext2(int fd, char *name) */ unsigned char sb[1024]; time_t mtime; - int size, bsize; + unsigned long long size; + int bsize; if (lseek(fd, 1024,0)!= 1024) return 0; if (read(fd, sb, 1024)!= 1024) @@ -522,10 +523,10 @@ int check_ext2(int fd, char *name) mtime = sb[44]|(sb[45]|(sb[46]|sb[47]<<8)<<8)<<8; bsize = sb[24]|(sb[25]|(sb[26]|sb[27]<<8)<<8)<<8; size = sb[4]|(sb[5]|(sb[6]|sb[7]<<8)<<8)<<8; + size <<= bsize; pr_err("%s appears to contain an ext2fs file system\n", name); - cont_err("size=%dK mtime=%s", - size*(1<