@@ -537,33 +537,29 @@ fn process_file(
537537 let mut result = Ok ( ( ) ) ;
538538
539539 match entry. flags ( ) {
540- fts_sys:: FTS_D => {
541- if options. recursive_mode . is_recursive ( ) {
542- if root_dev_ino_check ( root_dev_ino, file_dev_ino) {
543- // This happens e.g., with "chcon -R --preserve-root ... /"
544- // and with "chcon -RH --preserve-root ... symlink-to-root".
545- root_dev_ino_warn ( & file_full_name) ;
546-
547- // Tell fts not to traverse into this hierarchy.
548- let _ignored = fts. set ( fts_sys:: FTS_SKIP ) ;
549-
550- // Ensure that we do not process "/" on the second visit.
551- let _ignored = fts. read_next_entry ( ) ;
552-
553- return Err ( err (
554- translate ! ( "chcon-op-modifying-root-path" ) ,
555- io:: ErrorKind :: PermissionDenied ,
556- ) ) ;
557- }
540+ fts_sys:: FTS_D if options. recursive_mode . is_recursive ( ) => {
541+ if root_dev_ino_check ( root_dev_ino, file_dev_ino) {
542+ // This happens e.g., with "chcon -R --preserve-root ... /"
543+ // and with "chcon -RH --preserve-root ... symlink-to-root".
544+ root_dev_ino_warn ( & file_full_name) ;
558545
559- return Ok ( ( ) ) ;
546+ // Tell fts not to traverse into this hierarchy.
547+ let _ignored = fts. set ( fts_sys:: FTS_SKIP ) ;
548+
549+ // Ensure that we do not process "/" on the second visit.
550+ let _ignored = fts. read_next_entry ( ) ;
551+
552+ return Err ( err (
553+ translate ! ( "chcon-op-modifying-root-path" ) ,
554+ io:: ErrorKind :: PermissionDenied ,
555+ ) ) ;
560556 }
557+
558+ return Ok ( ( ) ) ;
561559 }
562560
563- fts_sys:: FTS_DP => {
564- if !options. recursive_mode . is_recursive ( ) {
565- return Ok ( ( ) ) ;
566- }
561+ fts_sys:: FTS_DP if !options. recursive_mode . is_recursive ( ) => {
562+ return Ok ( ( ) ) ;
567563 }
568564
569565 fts_sys:: FTS_NS => {
@@ -585,14 +581,14 @@ fn process_file(
585581
586582 fts_sys:: FTS_DNR => result = fts_err ( translate ! ( "chcon-op-reading-directory" ) ) ,
587583
588- fts_sys:: FTS_DC => {
589- if cycle_warning_required ( options. recursive_mode . fts_open_options ( ) , & entry) {
590- emit_cycle_warning ( & file_full_name ) ;
591- return Err ( err (
592- translate ! ( "chcon-op-reading-cyclic-directory" ) ,
593- io :: ErrorKind :: InvalidData ,
594- ) ) ;
595- }
584+ fts_sys:: FTS_DC
585+ if cycle_warning_required ( options. recursive_mode . fts_open_options ( ) , & entry) =>
586+ {
587+ emit_cycle_warning ( & file_full_name ) ;
588+ return Err ( err (
589+ translate ! ( "chcon-op-reading-cyclic-directory" ) ,
590+ io :: ErrorKind :: InvalidData ,
591+ ) ) ;
596592 }
597593
598594 _ => { }
0 commit comments