Skip to content

Commit 375fe17

Browse files
committed
auto merge of #17497 : nodakai/rust/libnative-misc-fixes, r=alexcrichton
libnative/io: datasync() wrongly called fsync(). liblibc and libnative: send() should use const buffers.
2 parents d299baf + d4b7bda commit 375fe17

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/liblibc/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4633,7 +4633,7 @@ pub mod funcs {
46334633
option_len: socklen_t) -> c_int;
46344634
pub fn recv(socket: c_int, buf: *mut c_void, len: size_t,
46354635
flags: c_int) -> ssize_t;
4636-
pub fn send(socket: c_int, buf: *mut c_void, len: size_t,
4636+
pub fn send(socket: c_int, buf: *const c_void, len: size_t,
46374637
flags: c_int) -> ssize_t;
46384638
pub fn recvfrom(socket: c_int, buf: *mut c_void, len: size_t,
46394639
flags: c_int, addr: *mut sockaddr,
@@ -4673,7 +4673,7 @@ pub mod funcs {
46734673
pub fn closesocket(socket: SOCKET) -> c_int;
46744674
pub fn recv(socket: SOCKET, buf: *mut c_void, len: c_int,
46754675
flags: c_int) -> c_int;
4676-
pub fn send(socket: SOCKET, buf: *mut c_void, len: c_int,
4676+
pub fn send(socket: SOCKET, buf: *const c_void, len: c_int,
46774677
flags: c_int) -> c_int;
46784678
pub fn recvfrom(socket: SOCKET, buf: *mut c_void, len: c_int,
46794679
flags: c_int, addr: *mut sockaddr,

src/libnative/io/file_unix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ impl rtio::RtioFileStream for CFile {
303303
self.flush().and_then(|()| self.fd.fsync())
304304
}
305305
fn datasync(&mut self) -> IoResult<()> {
306-
self.flush().and_then(|()| self.fd.fsync())
306+
self.flush().and_then(|()| self.fd.datasync())
307307
}
308308
fn truncate(&mut self, offset: i64) -> IoResult<()> {
309309
self.flush().and_then(|()| self.fd.truncate(offset))

src/libnative/io/net.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ impl rtio::RtioTcpStream for TcpStream {
337337
let dowrite = |nb: bool, buf: *const u8, len: uint| unsafe {
338338
let flags = if nb {c::MSG_DONTWAIT} else {0};
339339
libc::send(fd,
340-
buf as *mut libc::c_void,
340+
buf as *const _,
341341
len as wrlen,
342342
flags) as i64
343343
};

src/libnative/io/pipe_unix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ impl rtio::RtioPipe for UnixStream {
173173
let dowrite = |nb: bool, buf: *const u8, len: uint| unsafe {
174174
let flags = if nb {c::MSG_DONTWAIT} else {0};
175175
libc::send(fd,
176-
buf as *mut libc::c_void,
176+
buf as *const _,
177177
len as libc::size_t,
178178
flags) as i64
179179
};

0 commit comments

Comments
 (0)