Skip to content
Snippets Groups Projects
Commit fd058aed authored by srs5694's avatar srs5694
Browse files

Fixed bug that caused disk size to be read incorrectly on 32-bit

versions of FreeBSD.
parent 245a6a5a
No related branches found
No related tags found
No related merge requests found
0.6.1 (1/??/2009): 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. - Fixed bug that caused BSD disklabel conversion to not work.
0.6.0 (1/15/2009): 0.6.0 (1/15/2009):
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#ifndef __GPTSTRUCTS #ifndef __GPTSTRUCTS
#define __GPTSTRUCTS #define __GPTSTRUCTS
#define GPTFDISK_VERSION "0.6.1-pre2" #define GPTFDISK_VERSION "0.6.1-pre3"
using namespace std; using namespace std;
......
...@@ -588,6 +588,7 @@ int myWrite(int fd, char* buffer, int numBytes) { ...@@ -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. // to work around a problem returning a uint64_t value on Mac OS.
uint64_t disksize(int fd, int *err) { uint64_t disksize(int fd, int *err) {
long sz; // Do not delete; needed for Linux 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 long long b; // Do not delete; needed for Linux
uint64_t sectors = 0; // size in sectors uint64_t sectors = 0; // size in sectors
off_t bytes = 0; // size in bytes off_t bytes = 0; // size in bytes
...@@ -602,9 +603,9 @@ uint64_t disksize(int fd, int *err) { ...@@ -602,9 +603,9 @@ uint64_t disksize(int fd, int *err) {
*err = ioctl(fd, DKIOCGETBLOCKCOUNT, &sectors); *err = ioctl(fd, DKIOCGETBLOCKCOUNT, &sectors);
#else #else
#ifdef __FreeBSD__ #ifdef __FreeBSD__
*err = ioctl(fd, DIOCGMEDIASIZE, &sz); *err = ioctl(fd, DIOCGMEDIASIZE, &size);
b = GetBlockSize(fd); b = GetBlockSize(fd);
sectors = sz / b; sectors = size / b;
#else #else
*err = ioctl(fd, BLKGETSIZE, &sz); *err = ioctl(fd, BLKGETSIZE, &sz);
if (*err) { if (*err) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment