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

This commit is contained in:
Neil Brown 2008-04-29 17:13:55 +10:00
parent 519561f73f
commit c2c9bb6fe0
2 changed files with 6 additions and 0 deletions

View File

@ -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));

5
util.c
View File

@ -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