Fix missing 64-bit offset types in diskio-unix
Most of the types used in the diskio routines are explicitly 64-bit, but there were two usages of off_t, which is a 32-bit value when compiled in a 32-bit userspace. This causes gpt-fdisk to be unable to correctly write partitions on a drive larger than 4GiB when compiled in a 32-bit userspace. This change updates the two usages of off_t to off64_t, which is explicitly 64-bit and allows the program to work as intended.
This commit is contained in:
@@ -307,7 +307,7 @@ int DiskIO::DiskSync(void) {
|
|||||||
// Note that seeking beyond the end of the file is NOT detected as a failure!
|
// Note that seeking beyond the end of the file is NOT detected as a failure!
|
||||||
int DiskIO::Seek(uint64_t sector) {
|
int DiskIO::Seek(uint64_t sector) {
|
||||||
int retval = 1;
|
int retval = 1;
|
||||||
off_t seekTo, sought;
|
off64_t seekTo, sought;
|
||||||
|
|
||||||
// If disk isn't open, try to open it....
|
// If disk isn't open, try to open it....
|
||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
@@ -424,7 +424,7 @@ int DiskIO::Write(void* buffer, int numBytes) {
|
|||||||
// return correct values for disk image files.
|
// return correct values for disk image files.
|
||||||
uint64_t DiskIO::DiskSize(int *err) {
|
uint64_t DiskIO::DiskSize(int *err) {
|
||||||
uint64_t sectors = 0; // size in sectors
|
uint64_t sectors = 0; // size in sectors
|
||||||
off_t bytes = 0; // size in bytes
|
off64_t bytes = 0; // size in bytes
|
||||||
struct stat64 st;
|
struct stat64 st;
|
||||||
int platformFound = 0;
|
int platformFound = 0;
|
||||||
#ifdef __sun__
|
#ifdef __sun__
|
||||||
|
|||||||
Reference in New Issue
Block a user