File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change 11//! Linux `eventfd` implementation.
22use std:: cell:: { Cell , RefCell } ;
33use std:: io;
4- use std:: io:: { Error , ErrorKind } ;
4+ use std:: io:: ErrorKind ;
55
66use crate :: concurrency:: VClock ;
77use crate :: shims:: unix:: fd:: FileDescriptionRef ;
@@ -66,9 +66,7 @@ impl FileDescription for Event {
6666 let ty = ecx. machine . layouts . u64 ;
6767 // Check the size of slice, and return error only if the size of the slice < 8.
6868 if len < ty. size . bytes_usize ( ) {
69- ecx. set_last_error_from_io_error ( Error :: from ( ErrorKind :: InvalidInput ) ) ?;
70- ecx. write_int ( -1 , dest) ?;
71- return Ok ( ( ) ) ;
69+ return ecx. set_last_error_and_return ( ErrorKind :: InvalidInput , dest) ;
7270 }
7371
7472 // eventfd read at the size of u64.
@@ -78,9 +76,7 @@ impl FileDescription for Event {
7876 let counter = self . counter . get ( ) ;
7977 if counter == 0 {
8078 if self . is_nonblock {
81- ecx. set_last_error_from_io_error ( Error :: from ( ErrorKind :: WouldBlock ) ) ?;
82- ecx. write_int ( -1 , dest) ?;
83- return Ok ( ( ) ) ;
79+ return ecx. set_last_error_and_return ( ErrorKind :: WouldBlock , dest) ;
8480 }
8581
8682 throw_unsup_format ! ( "eventfd: blocking is unsupported" ) ;
You can’t perform that action at this time.
0 commit comments