Fixed bug that caused disk size to be read incorrectly on 32-bit
versions of FreeBSD.
diff --git a/CHANGELOG b/CHANGELOG
index b356096..8aede6e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,12 @@
0.6.1 (1/??/2009):
------------------
+- Fixed bug that returned incorrect disk size on 32-bit versions of
+ FreeBSD.
+
+- Fixed bug that prevented FreeBSD version from working on disk image
+ files.
+
- Fixed bug that caused BSD disklabel conversion to not work.
0.6.0 (1/15/2009):
diff --git a/gpt.h b/gpt.h
index 1f780ee..b4e0f06 100644
--- a/gpt.h
+++ b/gpt.h
@@ -16,7 +16,7 @@
#ifndef __GPTSTRUCTS
#define __GPTSTRUCTS
-#define GPTFDISK_VERSION "0.6.1-pre2"
+#define GPTFDISK_VERSION "0.6.1-pre3"
using namespace std;
diff --git a/support.cc b/support.cc
index 47ff438..0d4a7b3 100644
--- a/support.cc
+++ b/support.cc
@@ -588,6 +588,7 @@
// to work around a problem returning a uint64_t value on Mac OS.
uint64_t disksize(int fd, int *err) {
long sz; // Do not delete; needed for Linux
+ uint64_t size = 0; // Do not delete; needed for FreeBSD
long long b; // Do not delete; needed for Linux
uint64_t sectors = 0; // size in sectors
off_t bytes = 0; // size in bytes
@@ -602,9 +603,9 @@
*err = ioctl(fd, DKIOCGETBLOCKCOUNT, §ors);
#else
#ifdef __FreeBSD__
- *err = ioctl(fd, DIOCGMEDIASIZE, &sz);
+ *err = ioctl(fd, DIOCGMEDIASIZE, &size);
b = GetBlockSize(fd);
- sectors = sz / b;
+ sectors = size / b;
#else
*err = ioctl(fd, BLKGETSIZE, &sz);
if (*err) {