summaryrefslogtreecommitdiff
path: root/support.cc
diff options
context:
space:
mode:
Diffstat (limited to 'support.cc')
-rw-r--r--support.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/support.cc b/support.cc
index 47ff438..0d4a7b3 100644
--- a/support.cc
+++ b/support.cc
@@ -588,6 +588,7 @@ int myWrite(int fd, char* buffer, int numBytes) {
// 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 @@ uint64_t disksize(int fd, int *err) {
*err = ioctl(fd, DKIOCGETBLOCKCOUNT, &sectors);
#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) {