33//! Handler for Unix domain sockets
44use super :: { Connect , ReadWrite } ;
55use crate :: error:: { ClientErrorKind , Result } ;
6+ use std:: os:: unix:: net:: UnixStream ;
7+ use std:: path:: PathBuf ;
8+ use std:: time:: Duration ;
9+
10+ #[ cfg( not( feature = "no-fs-permission-check" ) ) ]
611use log:: error;
12+ #[ cfg( not( feature = "no-fs-permission-check" ) ) ]
713use std:: ffi:: OsStr ;
14+ #[ cfg( not( feature = "no-fs-permission-check" ) ) ]
815use std:: fs;
16+ #[ cfg( not( feature = "no-fs-permission-check" ) ) ]
917use std:: io:: { Error , ErrorKind } ;
18+ #[ cfg( not( feature = "no-fs-permission-check" ) ) ]
1019use std:: os:: unix:: fs:: MetadataExt ;
11- use std:: os:: unix:: net:: UnixStream ;
12- use std:: path:: PathBuf ;
13- use std:: time:: Duration ;
1420
1521const DEFAULT_SOCKET_PATH : & str = "/tmp/parsec/parsec.sock" ;
1622const DEFAULT_TIMEOUT : Duration = Duration :: from_secs ( 1 ) ;
@@ -26,7 +32,7 @@ pub struct Handler {
2632
2733impl Connect for Handler {
2834 fn connect ( & self ) -> Result < Box < dyn ReadWrite > > {
29- #[ cfg( not( no_fs_permission_check ) ) ]
35+ #[ cfg( not( feature = "no-fs-permission-check" ) ) ]
3036 self . secure_parsec_socket_folder ( ) ?;
3137
3238 let stream = UnixStream :: connect ( self . path . clone ( ) ) . map_err ( ClientErrorKind :: Ipc ) ?;
@@ -54,7 +60,7 @@ impl Handler {
5460
5561 /// Checks if the socket is inside a folder with correct owners and permissions to make sure it
5662 /// is from the Parsec service.
57- #[ cfg( not( no_fs_permission_check ) ) ]
63+ #[ cfg( not( feature = "no-fs-permission-check" ) ) ]
5864 fn secure_parsec_socket_folder ( & self ) -> Result < ( ) > {
5965 let mut socket_dir = self . path . clone ( ) ;
6066 if !socket_dir. pop ( ) {
0 commit comments