Anonymous avatar Anonymous committed 79fb436

replaced is_symlink with os.path.islink

Comments (0)

Files changed (1)

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)
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.