Neil Brown: diff -ru mdadm-2.6.4-orig/Query.c mdadm-2.6.4/Query.c

Martin F. Krafft madduck at alioth.debian.org
Wed Jun 25 15:42:27 UTC 2008


Module: mdadm
Branch: build
Commit: c2c9bb6fe04fe2800fcda3ff285b16ca9ecd38ae
URL:    http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=c2c9bb6fe04fe2800fcda3ff285b16ca9ecd38ae

Author: Neil Brown <neilb at suse.de>
Date:   Tue Apr 29 17:13:55 2008 +1000

diff -ru mdadm-2.6.4-orig/Query.c mdadm-2.6.4/Query.c

---

 mdadm.h |    1 +
 util.c  |    5 +++++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/mdadm.h b/mdadm.h
index 1a7db81..2a5e1c8 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -28,6 +28,7 @@
  */
 
 #define	_GNU_SOURCE
+#define _FILE_OFFSET_BITS 64
 #include	<unistd.h>
 #if !defined(__dietlibc__) && !defined(__KLIBC__)
 extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
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




More information about the pkg-mdadm-commits mailing list