File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -733,10 +733,12 @@ impl FsPath {
733733 XATTR_NAME_SELINUX . as_ptr ( ) . cast ( ) ,
734734 con. as_mut_ptr ( ) . cast ( ) ,
735735 con. capacity ( ) ,
736- )
737- . check_os_err ( ) ?;
736+ ) ;
738737 if sz < 1 {
739738 con. clear ( ) ;
739+ if * errno ( ) != libc:: ENODATA {
740+ return Err ( io:: Error :: last_os_error ( ) ) ;
741+ }
740742 } else {
741743 con. set_len ( ( sz - 1 ) as usize ) ;
742744 }
@@ -840,9 +842,14 @@ pub fn fd_get_attr(fd: RawFd) -> io::Result<FileAttr> {
840842 XATTR_NAME_SELINUX . as_ptr ( ) . cast ( ) ,
841843 attr. con . as_mut_ptr ( ) . cast ( ) ,
842844 attr. con . capacity ( ) ,
843- )
844- . check_os_err ( ) ?;
845- attr. con . set_len ( ( sz - 1 ) as usize ) ;
845+ ) ;
846+ if sz < 1 {
847+ if * errno ( ) != libc:: ENODATA {
848+ return Err ( io:: Error :: last_os_error ( ) ) ;
849+ }
850+ } else {
851+ attr. con . set_len ( ( sz - 1 ) as usize ) ;
852+ }
846853 }
847854 }
848855 Ok ( attr)
You can’t perform that action at this time.
0 commit comments