summaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2008-04-29 17:13:55 +1000
committerNeil Brown <neilb@suse.de>2008-04-29 17:13:55 +1000
commitc2c9bb6fe04fe2800fcda3ff285b16ca9ecd38ae (patch)
tree7de419da432add1fde71dbd8dfcd91a67a235ade /util.c
parent519561f73f7ba987affde8b174d2691bb098439d (diff)
downloadmdadm-c2c9bb6fe04fe2800fcda3ff285b16ca9ecd38ae.tar.gz
mdadm-c2c9bb6fe04fe2800fcda3ff285b16ca9ecd38ae.tar.xz
mdadm-c2c9bb6fe04fe2800fcda3ff285b16ca9ecd38ae.zip
diff -ru mdadm-2.6.4-orig/Query.c mdadm-2.6.4/Query.c
Diffstat (limited to 'util.c')
-rw-r--r--util.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/util.c b/util.c
index 1ba236b..bd46999 100644
--- a/util.c
+++ b/util.c
@@ -830,6 +830,11 @@ struct supertype *guess_super(int fd)
int get_dev_size(int fd, char *dname, unsigned long long *sizep)
{
unsigned long long ldsize;
+ struct stat st;
+
+ if (fstat(fd, &st) != -1 && S_ISREG(st.st_mode))
+ ldsize = (unsigned long long)st.st_size;
+ else
#ifdef BLKGETSIZE64
if (ioctl(fd, BLKGETSIZE64, &ldsize) != 0)
#endif