Fix fseeko not flushing write buffer

This commit is contained in:
Jeremy Soller
2018-12-02 12:04:15 -07:00
parent 62b0b0d508
commit 4ced856b39
+5
View File
@@ -484,6 +484,11 @@ pub unsafe extern "C" fn fseeko(stream: *mut FILE, mut off: off_t, whence: c_int
off -= (stream.read_size - stream.read_pos) as off_t;
}
// Flush write buffer before seek
if stream.flush().is_err() {
return -1;
}
let err = Sys::lseek(*stream.file, off, whence);
if err < 0 {
return err as c_int;