]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blobdiff - lib/ext2fs/llseek.c
ext2fs: Use 64bit lseek when _FILE_OFFSET_BITS is 64
[thirdparty/e2fsprogs.git] / lib / ext2fs / llseek.c
index 2730f20be3512bab9ddb97531fde5a146cd6e7ab..45f21d09d6e09295b15d7056b81c1427b636b3b8 100644 (file)
@@ -9,8 +9,12 @@
  * %End-Header%
  */
 
+#ifndef _LARGEFILE_SOURCE
 #define _LARGEFILE_SOURCE
+#endif
+#ifndef _LARGEFILE64_SOURCE
 #define _LARGEFILE64_SOURCE
+#endif
 
 #include "config.h"
 #if HAVE_SYS_TYPES_H
@@ -47,9 +51,9 @@ extern long long llseek (int fd, long long offset, int origin);
 
 #else  /* ! HAVE_LLSEEK */
 
-#if SIZEOF_LONG == SIZEOF_LONG_LONG
+#if SIZEOF_LONG == SIZEOF_LONG_LONG || _FILE_OFFSET_BITS+0 == 64
 
-#define llseek lseek
+#define my_llseek lseek
 
 #else /* SIZEOF_LONG != SIZEOF_LONG_LONG */
 
@@ -65,7 +69,7 @@ static int _llseek (unsigned int, unsigned long,
 
 static _syscall5(int,_llseek,unsigned int,fd,unsigned long,offset_high,
                 unsigned long, offset_low,ext2_loff_t *,result,
-                unsigned int, origin)
+                unsigned int, origin);
 #endif
 
 static ext2_loff_t my_llseek (int fd, ext2_loff_t offset, int origin)
@@ -83,7 +87,7 @@ static ext2_loff_t my_llseek (int fd, ext2_loff_t offset, int origin)
        return (retval == -1 ? (ext2_loff_t) retval : result);
 }
 
-#endif /* __alpha__ || __ia64__ */
+#endif /* SIZE_LONG == SIZEOF_LONG_LONG */
 
 #endif /* HAVE_LLSEEK */
 #endif /* defined(HAVE_LSEEK64) && defined(HAVE_LSEEK64_PROTOTYPE) */
@@ -91,7 +95,7 @@ static ext2_loff_t my_llseek (int fd, ext2_loff_t offset, int origin)
 ext2_loff_t ext2fs_llseek (int fd, ext2_loff_t offset, int origin)
 {
 #if SIZEOF_OFF_T >= SIZEOF_LONG_LONG
-       return lseek (fd, offset, origin);
+       return my_llseek (fd, offset, origin);
 #else
        ext2_loff_t result;
        static int do_compat = 0;