Skip to content

Commit dcdfed4

Browse files
committed
std: use LFS lseek64 on Linux
1 parent 1ea38f8 commit dcdfed4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/libstd/sys/unix/fs.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use os::unix::prelude::*;
1515
use ffi::{CString, CStr, OsString, OsStr};
1616
use fmt;
1717
use io::{self, Error, ErrorKind, SeekFrom};
18-
use libc::{self, dirent, c_int, off_t, mode_t};
18+
use libc::{self, dirent, c_int, mode_t};
1919
use mem;
2020
use path::{Path, PathBuf};
2121
use ptr;
@@ -26,10 +26,10 @@ use sys::{cvt, cvt_r};
2626
use sys_common::{AsInner, FromInner};
2727

2828
#[cfg(target_os = "linux")]
29-
use libc::{stat64, fstat64, lstat64, off64_t, ftruncate64};
29+
use libc::{stat64, fstat64, lstat64, off64_t, ftruncate64, lseek64};
3030
#[cfg(not(target_os = "linux"))]
3131
use libc::{stat as stat64, fstat as fstat64, lstat as lstat64, off_t as off64_t,
32-
ftruncate as ftruncate64};
32+
ftruncate as ftruncate64, lseek as lseek64};
3333

3434
pub struct File(FileDesc);
3535

@@ -461,11 +461,11 @@ impl File {
461461

462462
pub fn seek(&self, pos: SeekFrom) -> io::Result<u64> {
463463
let (whence, pos) = match pos {
464-
SeekFrom::Start(off) => (libc::SEEK_SET, off as off_t),
465-
SeekFrom::End(off) => (libc::SEEK_END, off as off_t),
466-
SeekFrom::Current(off) => (libc::SEEK_CUR, off as off_t),
464+
SeekFrom::Start(off) => (libc::SEEK_SET, off as off64_t),
465+
SeekFrom::End(off) => (libc::SEEK_END, off as off64_t),
466+
SeekFrom::Current(off) => (libc::SEEK_CUR, off as off64_t),
467467
};
468-
let n = try!(cvt(unsafe { libc::lseek(self.0.raw(), pos, whence) }));
468+
let n = try!(cvt(unsafe { lseek64(self.0.raw(), pos, whence) }));
469469
Ok(n as u64)
470470
}
471471

0 commit comments

Comments
 (0)