octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #57644] fseek fread fail for files >4GB 5.1.0


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #57644] fseek fread fail for files >4GB 5.1.0 on Windows10 64-bit x64 proc
Date: Thu, 23 Jan 2020 03:18:29 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0

Follow-up Comment #26, bug #57644 (project octave):

Maybe files >4 GiB are rare and no one noticed yet. But I also think that this
is somewhat unlikely.

MS discourages calling 'lseek' at all. [1]

As I understand it, I'd guess the following change might be correct:

diff -r c34f677e6117 lib/lseek.c
--- a/lib/lseek.c       Sun Mar 17 19:27:20 2019 +0100
+++ b/lib/lseek.c       Thu Jan 23 09:12:26 2020 +0100
@@ -52,6 +52,7 @@
       errno = ESPIPE;
       return -1;
     }
+  return _lseeki64 (fd, offset, whence);
 #else
   /* BeOS lseek mistakenly succeeds on pipes...  */
   struct stat statbuf;
@@ -62,10 +63,6 @@
       errno = ESPIPE;
       return -1;
     }
-#endif
-#if _GL_WINDOWS_64_BIT_OFF_T
-  return _lseeki64 (fd, offset, whence);
-#else
   return lseek (fd, offset, whence);
 #endif
 }


Gnulib makes sure with its #define macros that off_t is always 64 bit wide. So
it should be save to always call "_lseeki64".
But I might be missing something.

[1]:
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/lseek?redirectedfrom=MSDN&view=vs-2019

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57644>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]