Skip to content

Commit 466b694

Browse files
committed
Fix max limit in Client::new: Use PIPE_BUF
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
1 parent 210170b commit 466b694

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/unix.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use libc::c_int;
1+
use libc::{c_int, PIPE_BUF};
2+
23
use std::fs::File;
34
use std::io::{self, Read, Write};
45
use std::mem;
@@ -22,7 +23,7 @@ pub struct Acquired {
2223

2324
impl Client {
2425
pub fn new(mut limit: usize) -> io::Result<Client> {
25-
if limit > 4096 {
26+
if limit > PIPE_BUF {
2627
return Err(io::Error::new(io::ErrorKind::Other, "Can't have limit larger than 4096 since the pipe would block forever when writing to it"));
2728
}
2829

0 commit comments

Comments
 (0)