fix - block device support was broken...

bad pointer dereferencing in ioctl call
This commit is contained in:
Gilles Grandou 2011-07-14 00:13:13 +02:00
parent 63ad881fac
commit 1fb6383d76

View File

@ -107,18 +107,18 @@ void abort_printf(char *fmt, ...)
} }
int blkgetsize(int fd, unsigned long long *bsize) int blkgetsize(int fd, unsigned long long *pbsize)
{ {
# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
return ioctl(fd, DIOCGMEDIASIZE, &bsize); return ioctl(fd, DIOCGMEDIASIZE, pbsize);
# elif defined(__APPLE__) # elif defined(__APPLE__)
return ioctl(fd, DKIOCGETBLOCKCOUNT, &bsize); return ioctl(fd, DKIOCGETBLOCKCOUNT, pbsize);
# elif defined(__NetBSD__) # elif defined(__NetBSD__)
// does a suitable ioctl exist? // does a suitable ioctl exist?
// return (ioctl(fd, DIOCGDINFO, &label) == -1); // return (ioctl(fd, DIOCGDINFO, &label) == -1);
return 1; return 1;
# elif defined(__linux__) || defined(__CYGWIN__) # elif defined(__linux__) || defined(__CYGWIN__)
return ioctl(fd, BLKGETSIZE64, &bsize); return ioctl(fd, BLKGETSIZE64, pbsize);
# elif defined(__GNU__) # elif defined(__GNU__)
// does a suitable ioctl for HURD exist? // does a suitable ioctl for HURD exist?
return 1; return 1;