Commits

Anonymous committed 79fb436

replaced is_symlink with os.path.islink

  • Participants
  • Parent commits 49703a9

Comments (0)

Files changed (1)

File nom/filesystem.py

         if any(re.search(pat,entry) for pat in pats):
             pending.append(i)
 
-        elif is_symlink(os.path.join(base, entry)):
+        elif os.path.islink(os.path.join(base, entry)):
             # os.walk won't descend symlinks, but we may as well drop
             # them here while we're at it.
             pending.append(i)
         if any(re.search(pat,entry) for pat in pats):
             pending.append(i)
 
-        elif is_symlink(os.path.join(base, entry)):
+        elif os.path.islink(os.path.join(base, entry)):
             # We refuse to process symlinks for numerous reasons
             pending.append(i)
 
         del files[index]
 
 
-def is_symlink(path):
-    """Returns true iff path is a symlink"""
-    return stat.S_ISLNK(os.lstat(path)[stat.ST_MODE])
-
-
 def open_input_file(path):
     # XXX SECURITY is it worth preventing symlink races here to avoid
     # traversal attacks?  The shared CGI permissions model is really
     
 
 def make_output_file(path):
-    if os.path.exists(path) and is_symlink(path):
+    if os.path.exists(path) and os.path.islink(path):
         # XXX SECURITY This is laughable, and won't prevent symlink races
         raise RuntimeError('Will not overwrite symlink in %s' % path)