aports/main/gptfdisk/fix-musl.patch
2023-10-22 02:13:43 +02:00

58 lines
1.8 KiB
Diff

--- a/diskio-unix.cc
+++ b/diskio-unix.cc
@@ -52,7 +52,7 @@
// work.
int DiskIO::OpenForRead(void) {
int shouldOpen = 1;
- struct stat64 st;
+ struct stat st;
if (isOpen) { // file is already open
if (openForWrite) {
@@ -78,7 +78,7 @@
} else {
isOpen = 0;
openForWrite = 0;
- if (fstat64(fd, &st) == 0) {
+ if (fstat(fd, &st) == 0) {
if (S_ISDIR(st.st_mode))
cerr << "The specified path is a directory!\n";
#if !(defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) \
@@ -311,7 +311,7 @@
// Note that seeking beyond the end of the file is NOT detected as a failure!
int DiskIO::Seek(uint64_t sector) {
int retval = 1;
- off64_t seekTo, sought;
+ off_t seekTo, sought;
// If disk isn't open, try to open it....
if (!isOpen) {
@@ -320,7 +320,7 @@
if (isOpen) {
seekTo = sector * (uint64_t) GetBlockSize();
- sought = lseek64(fd, seekTo, SEEK_SET);
+ sought = lseek(fd, seekTo, SEEK_SET);
if (sought != seekTo) {
retval = 0;
} // if
@@ -428,8 +428,8 @@
// return correct values for disk image files.
uint64_t DiskIO::DiskSize(int *err) {
uint64_t sectors = 0; // size in sectors
- off64_t bytes = 0; // size in bytes
- struct stat64 st;
+ off_t bytes = 0; // size in bytes
+ struct stat st;
int platformFound = 0;
#ifdef __sun__
struct dk_minfo minfo;
@@ -488,7 +488,7 @@
// file (a QEMU image, dd backup, or what have you) and see what
// fstat() gives us....
if ((sectors == 0) || (*err == -1)) {
- if (fstat64(fd, &st) == 0) {
+ if (fstat(fd, &st) == 0) {
bytes = st.st_size;
if ((bytes % UINT64_C(512)) != 0)
cerr << "Warning: File size is not a multiple of 512 bytes!"