summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sys/socket.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/sys/socket.rs b/src/sys/socket.rs
index f8b245e2..08f2515c 100644
--- a/src/sys/socket.rs
+++ b/src/sys/socket.rs
@@ -348,7 +348,7 @@ pub fn recvfrom(sockfd: Fd, buf: &mut [u8], addr: &mut SockAddr) -> SysResult<ui
Ok(ret as uint)
}
-pub fn sendto(sockfd: Fd, buf: &[u8], addr: &SockAddr) -> SysResult<()> {
+pub fn sendto(sockfd: Fd, buf: &[u8], addr: &SockAddr) -> SysResult<uint> {
let len = match *addr {
SockIpV4(_) => mem::size_of::<sockaddr_in>(),
SockIpV6(_) => mem::size_of::<sockaddr_in6>(),
@@ -358,10 +358,10 @@ pub fn sendto(sockfd: Fd, buf: &[u8], addr: &SockAddr) -> SysResult<()> {
let ret = unsafe { ffi::sendto(sockfd, buf.as_ptr() as *const c_void, buf.len() as size_t, 0, mem::transmute(addr), len as socklen_t) };
if ret < 0 {
- return Err(SysError::last());
+ Err(SysError::last())
+ } else {
+ Ok(ret as uint)
}
-
- Ok(())
}
#[repr(C)]