]> granicus.if.org Git - python/commitdiff
only test for named pipe when os.stat doesn't raise #6209
authorBenjamin Peterson <benjamin@python.org>
Fri, 5 Jun 2009 19:09:28 +0000 (19:09 +0000)
committerBenjamin Peterson <benjamin@python.org>
Fri, 5 Jun 2009 19:09:28 +0000 (19:09 +0000)
Lib/shutil.py

index c46ec47fd3b32371efe598ec6a2636c9e3ab861a..a689256f15dc0dcc10305d733f980848c7e76ee7 100644 (file)
@@ -58,9 +58,10 @@ def copyfile(src, dst):
         except OSError:
             # File most likely does not exist
             pass
-        # XXX What about other special files? (sockets, devices...)
-        if stat.S_ISFIFO(st.st_mode):
-            raise SpecialFileError("`%s` is a named pipe" % fn)
+        else:
+            # XXX What about other special files? (sockets, devices...)
+            if stat.S_ISFIFO(st.st_mode):
+                raise SpecialFileError("`%s` is a named pipe" % fn)
     try:
         fsrc = open(src, 'rb')
         fdst = open(dst, 'wb')