From 7e962166dfa1c55489d9637d829cb8e16f6de32a Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Sun, 21 Feb 2016 01:04:14 -0800 Subject: [PATCH] std: Use Android LFS off64_t, ftruncate64, and lseek64 Android should use 64-bit LFS symbols for `lseek` and `ftruncate`, lest those offset parameters suffer a lossy cast down to a 32-bit `off_t`. Unlike GNU/Linux, Android's `stat`, `dirent`, and related functions are always 64-bit LFS compatible, and `open` already implies `O_LARGEFILE`, so all those don't need to follow Linux. It might be nice to unify them anyway, but those other LFS symbols aren't present in API 18 bionic. r? @alexcrichton --- src/liblibc | 2 +- src/libstd/sys/unix/fs.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/liblibc b/src/liblibc index 403bdc8839491..1b1eea2cdd77c 160000 --- a/src/liblibc +++ b/src/liblibc @@ -1 +1 @@ -Subproject commit 403bdc88394919f297bdb365032044cc0481c319 +Subproject commit 1b1eea2cdd77c63d73ba0b09b905a91910d1c992 diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index e8e0a604e552e..e5bdfa3ac88ca 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -27,7 +27,10 @@ use sys_common::{AsInner, FromInner}; #[cfg(target_os = "linux")] use libc::{stat64, fstat64, lstat64, off64_t, ftruncate64, lseek64, dirent64, readdir64_r, open64}; -#[cfg(not(target_os = "linux"))] +#[cfg(target_os = "android")] +use libc::{stat as stat64, fstat as fstat64, lstat as lstat64, off64_t, ftruncate64, lseek64, + dirent as dirent64, open as open64}; +#[cfg(not(any(target_os = "linux", target_os = "android")))] use libc::{stat as stat64, fstat as fstat64, lstat as lstat64, off_t as off64_t, ftruncate as ftruncate64, lseek as lseek64, dirent as dirent64, open as open64}; #[cfg(not(any(target_os = "linux", target_os = "solaris")))]