diff options
| author | Josh Stone <cuviper@gmail.com> | 2016-02-14 16:15:39 -0800 |
|---|---|---|
| committer | Josh Stone <cuviper@gmail.com> | 2016-02-14 19:11:39 -0800 |
| commit | dcdfed49d7414a44bb3cfe73cf62ad2881055230 (patch) | |
| tree | 701739b6347d57515787caa8e26463e889688e40 /src/libstd/sys | |
| parent | 1ea38f8928a017ce544faf9d025853211dbce49c (diff) | |
| download | rust-dcdfed49d7414a44bb3cfe73cf62ad2881055230.tar.gz rust-dcdfed49d7414a44bb3cfe73cf62ad2881055230.zip | |
std: use LFS lseek64 on Linux
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/unix/fs.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index 55667aced5e..ab8b700e193 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -15,7 +15,7 @@ use os::unix::prelude::*; use ffi::{CString, CStr, OsString, OsStr}; use fmt; use io::{self, Error, ErrorKind, SeekFrom}; -use libc::{self, dirent, c_int, off_t, mode_t}; +use libc::{self, dirent, c_int, mode_t}; use mem; use path::{Path, PathBuf}; use ptr; @@ -26,10 +26,10 @@ use sys::{cvt, cvt_r}; use sys_common::{AsInner, FromInner}; #[cfg(target_os = "linux")] -use libc::{stat64, fstat64, lstat64, off64_t, ftruncate64}; +use libc::{stat64, fstat64, lstat64, off64_t, ftruncate64, lseek64}; #[cfg(not(target_os = "linux"))] use libc::{stat as stat64, fstat as fstat64, lstat as lstat64, off_t as off64_t, - ftruncate as ftruncate64}; + ftruncate as ftruncate64, lseek as lseek64}; pub struct File(FileDesc); @@ -461,11 +461,11 @@ impl File { pub fn seek(&self, pos: SeekFrom) -> io::Result<u64> { let (whence, pos) = match pos { - SeekFrom::Start(off) => (libc::SEEK_SET, off as off_t), - SeekFrom::End(off) => (libc::SEEK_END, off as off_t), - SeekFrom::Current(off) => (libc::SEEK_CUR, off as off_t), + SeekFrom::Start(off) => (libc::SEEK_SET, off as off64_t), + SeekFrom::End(off) => (libc::SEEK_END, off as off64_t), + SeekFrom::Current(off) => (libc::SEEK_CUR, off as off64_t), }; - let n = try!(cvt(unsafe { libc::lseek(self.0.raw(), pos, whence) })); + let n = try!(cvt(unsafe { lseek64(self.0.raw(), pos, whence) })); Ok(n as u64) } |
