Skip to content

Commit 2b3de95

Browse files
committed
Fix #1
1 parent a070ca7 commit 2b3de95

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/sys.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,25 @@ use libc as sys;
55
#[macro_export]
66
macro_rules! syscall {
77
($ret:expr) => {{
8-
if $ret != 0 {
9-
Err(::std::io::Error::from_raw_os_error($ret))
8+
let result = $ret;
9+
10+
if result != 0 {
11+
Err(::std::io::Error::from_raw_os_error(result))
1012
} else {
11-
Ok($ret)
13+
Ok(result)
1214
}
1315
}};
1416
}
1517

1618
#[macro_export]
1719
macro_rules! syscall_los {
1820
($ret:expr) => {{
19-
if $ret == (u32::MAX as _) {
20-
Err(io::Error::last_os_error())
21+
let result = $ret;
22+
23+
if result == -1 {
24+
Err(::std::io::Error::last_os_error())
2125
} else {
22-
Ok($ret)
26+
Ok(result)
2327
}
2428
}};
2529
}

0 commit comments

Comments
 (0)