int minor;
struct supertype *st = NULL;
struct mdinfo *sra;
- char *verstr = NULL;
+ char *verstr;
char version[20];
int i;
if (sra) {
vers = sra->array.major_version;
minor = sra->array.minor_version;
+ verstr = sra->text_version;
} else {
if (ioctl(fd, GET_ARRAY_INFO, &array))
array.major_version = array.minor_version = 0;
vers = array.major_version;
minor = array.minor_version;
+ verstr = "";
}
if (vers != -1) {
st->ss = NULL;
rv = superlist[bestsuper]->load_super(st, fd, NULL);
if (rv == 0) {
- ss->free_super(st);
+ superlist[bestsuper]->free_super(st);
return st;
}
}
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