File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ impl UnixListener {
1818 pub fn bind < P : AsRef < Path > > ( path : P ) -> io:: Result < UnixListener > {
1919 unsafe {
2020 let inner = Socket :: new_unix ( ) ?;
21- let ( addr, len) = sockaddr_un ( path) ?;
21+ let ( addr, len) = sockaddr_un ( path. as_ref ( ) ) ?;
2222 cvt ( bind ( inner. as_raw ( ) , & addr as * const _ as * const _ , len) ) ?;
2323 cvt ( listen ( inner. as_raw ( ) , 128 ) ) ?;
2424 Ok ( UnixListener ( inner) )
Original file line number Diff line number Diff line change @@ -9,11 +9,10 @@ use std::thread;
99fn smoke_bind_connect ( ) {
1010 let tmp = std:: env:: temp_dir ( ) ;
1111 let sock_path = tmp. join ( "rust-test-uds.sock" ) ;
12-
13- let listener = UnixListener :: bind ( sock_path. as_path ( ) ) . expect ( "bind failed" ) ;
14-
12+ let listener = UnixListener :: bind ( & sock_path) . expect ( "bind failed" ) ;
13+ let sock_path_clone = sock_path. clone ( ) ;
1514 let tx = thread:: spawn ( move || {
16- let mut stream = UnixStream :: connect ( & sock_path ) . expect ( "connect failed" ) ;
15+ let mut stream = UnixStream :: connect ( & sock_path_clone ) . expect ( "connect failed" ) ;
1716 stream. write_all ( b"hello" ) . expect ( "write failed" ) ;
1817 } ) ;
1918
You can’t perform that action at this time.
0 commit comments