Ver código fonte

cmFileSys.c: Changed _cmFileSysDirEntries() to check for symbolic

links prior to checking for files or dir's because a link may be
identified as file or directory.
master
kevin 11 anos atrás
pai
commit
e669344036
1 arquivos alterados com 18 adições e 17 exclusões
  1. 18
    17
      cmFileSys.c

+ 18
- 17
cmFileSys.c Ver arquivo

896
         goto errLabel;
896
         goto errLabel;
897
       }
897
       }
898
 
898
 
899
-
900
-      // is the entry a file
901
-      if( _cmFileSysIsFile(drp->p,fn) )
899
+      // is a link
900
+      if( _cmFileSysIsLink(drp->p,fn) )
902
       {
901
       {
903
-        if( cmIsFlag(drp->filterFlags,kFileFsFl)==false )
902
+        if( cmIsFlag(drp->filterFlags,kLinkFsFl) == false )
904
           continue;
903
           continue;
905
 
904
 
906
-        flags |= kFileFsFl;
905
+        flags |= kLinkFsFl;
906
+
907
+        if( cmIsFlag(drp->filterFlags,kRecurseLinksFsFl) )
908
+          if((rc = _cmFileSysDirGetEntries(drp,fn)) != kOkFsRC )
909
+            goto errLabel;
907
       }
910
       }
908
       else
911
       else
909
       {
912
       {
910
-        // is the entry a dir
911
-        if( _cmFileSysIsDir(drp->p,fn) )
913
+
914
+        // is the entry a file
915
+        if( _cmFileSysIsFile(drp->p,fn) )
912
         {
916
         {
913
-          if( cmIsFlag(drp->filterFlags,kDirFsFl) == false)
917
+          if( cmIsFlag(drp->filterFlags,kFileFsFl)==false )
914
             continue;
918
             continue;
915
 
919
 
916
-          flags |= kDirFsFl;
917
-
918
-          if( cmIsFlag(drp->filterFlags,kRecurseFsFl) )
919
-            if((rc = _cmFileSysDirGetEntries(drp,fn)) != kOkFsRC )
920
-              goto errLabel;
920
+          flags |= kFileFsFl;
921
         }
921
         }
922
         else
922
         else
923
         {
923
         {
924
-          if( _cmFileSysIsLink(drp->p,fn) )
924
+          // is the entry a dir
925
+          if( _cmFileSysIsDir(drp->p,fn) )
925
           {
926
           {
926
-            if( cmIsFlag(drp->filterFlags,kLinkFsFl) == false )
927
+            if( cmIsFlag(drp->filterFlags,kDirFsFl) == false)
927
               continue;
928
               continue;
928
 
929
 
929
-            flags |= kLinkFsFl;
930
+            flags |= kDirFsFl;
930
 
931
 
931
-            if( cmIsFlag(drp->filterFlags,kRecurseLinksFsFl) )
932
+            if( cmIsFlag(drp->filterFlags,kRecurseFsFl) )
932
               if((rc = _cmFileSysDirGetEntries(drp,fn)) != kOkFsRC )
933
               if((rc = _cmFileSysDirGetEntries(drp,fn)) != kOkFsRC )
933
                 goto errLabel;
934
                 goto errLabel;
934
           }
935
           }

Carregando…
Cancelar
Salvar