summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Bamberger <abamberger@arista.com>2020-08-11 14:16:19 -0500
committerAaron Bamberger <abamberger@arista.com>2020-08-11 14:16:19 -0500
commitc03d1105dc6ac3b0bd253d45cec0573fa5dcef46 (patch)
treeb0220735f41ecd9cf9c89ce1ce2038d4dc6e6bf3
parentcfd8d2138e9bdbdfed2a59dbf51f232f7fb6bbc6 (diff)
downloadsgdisk-c03d1105dc6ac3b0bd253d45cec0573fa5dcef46.tar.gz
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.
-rw-r--r--diskio-unix.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/diskio-unix.cc b/diskio-unix.cc
index d9f8b8d..35a4f5e 100644
--- a/diskio-unix.cc
+++ b/diskio-unix.cc
@@ -307,7 +307,7 @@ int DiskIO::DiskSync(void) {
// Note that seeking beyond the end of the file is NOT detected as a failure!
int DiskIO::Seek(uint64_t sector) {
int retval = 1;
- off_t seekTo, sought;
+ off64_t seekTo, sought;
// If disk isn't open, try to open it....
if (!isOpen) {
@@ -424,7 +424,7 @@ int DiskIO::Write(void* buffer, int numBytes) {
// return correct values for disk image files.
uint64_t DiskIO::DiskSize(int *err) {
uint64_t sectors = 0; // size in sectors
- off_t bytes = 0; // size in bytes
+ off64_t bytes = 0; // size in bytes
struct stat64 st;
int platformFound = 0;
#ifdef __sun__