]> arthur.barton.de Git - bup.git/commitdiff
Always fall back to socket()/bind() when os.mknod(...S_IFSOCK) fails.
authorRob Browning <rlb@defaultvalue.org>
Mon, 16 Sep 2013 17:56:27 +0000 (12:56 -0500)
committerRob Browning <rlb@defaultvalue.org>
Mon, 16 Sep 2013 17:56:29 +0000 (12:56 -0500)
Previously bup would use socket()/bind() instead of os.mknod(... |
stat.S_IFSOCK) on Cygwin, but this issue isn't Cygwin specific.
Remove the platform conditionalization, and fall back to
socket()/bind() any time mknod() fails with EINVAL.

Thanks to Robert Edmonds <edmonds@debian.org> for reporting the
relevant failure on a Debian kFreeBSD buildd.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/metadata.py

index 2c6eb88d0eb1920eed9546c36e2434426e17eac9..e30a6634a85506b1ac97330cbf60de2a38883d23 100644 (file)
@@ -312,11 +312,14 @@ class Metadata:
             assert(self._recognized_file_type())
             os.mknod(path, 0600 | stat.S_IFIFO)
         elif stat.S_ISSOCK(self.mode):
-            if not sys.platform.startswith('cygwin'):
+            try:
                 os.mknod(path, 0600 | stat.S_IFSOCK)
-            else:
-                s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
-                s.bind(path)
+            except OSError, e:
+                if e.errno == errno.EINVAL:
+                    s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
+                    s.bind(path)
+                else:
+                    raise
         elif stat.S_ISLNK(self.mode):
             assert(self._recognized_file_type())
             if self.symlink_target and create_symlinks: