Skip to content

Commit 36a5e2e

Browse files
authored
Fix non_blocking_read signature (#81)
should take mutable reference to buffer.
1 parent e939b31 commit 36a5e2e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/unix.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ impl Client {
291291
{
292292
let read = self.read().as_raw_fd();
293293
loop {
294-
match non_blocking_read(read, &buf) {
294+
match non_blocking_read(read, &mut buf) {
295295
Ok(1) => return Ok(Some(Acquired { byte: buf[0] })),
296296
Ok(_) => {
297297
return Err(io::Error::new(
@@ -587,7 +587,7 @@ fn cvt_ssize(t: libc::ssize_t) -> io::Result<libc::ssize_t> {
587587
}
588588

589589
#[cfg(target_os = "linux")]
590-
fn non_blocking_read(fd: c_int, buf: &[u8]) -> io::Result<usize> {
590+
fn non_blocking_read(fd: c_int, buf: &mut [u8]) -> io::Result<usize> {
591591
static IS_NONBLOCKING_READ_UNSUPPORTED: AtomicBool = AtomicBool::new(false);
592592

593593
if IS_NONBLOCKING_READ_UNSUPPORTED.load(Ordering::Relaxed) {

0 commit comments

Comments
 (0)