aboutsummaryrefslogtreecommitdiffstats
path: root/main/gptfdisk/fix-musl.patch
blob: 69c26f025b066d456a464baa09707db6ed010054 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
--- 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!"