]> arthur.barton.de Git - bup.git/commitdiff
metadata.py: use socket() instead of mknod(...IF_SOCK) on Cygwin.
authorRob Browning <rlb@defaultvalue.org>
Sun, 26 May 2013 16:05:56 +0000 (11:05 -0500)
committerRob Browning <rlb@defaultvalue.org>
Mon, 27 May 2013 17:28:51 +0000 (12:28 -0500)
Apparently os.mknod(...IF_SOCK) fails on Cygwin, but our t/mksock tool
(which uses socket()) works just fine, so use that in
_create_via_common_rec() when on Cygwin.

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

index c317eee487a8f118dd4dbc04a89d6c0d2a637bd3..384991ed7b46ff52e61d6b7ea23e0b44729f44c7 100644 (file)
@@ -4,7 +4,7 @@
 #
 # This code is covered under the terms of the GNU Library General
 # Public License as described in the bup LICENSE file.
-import errno, os, sys, stat, time, pwd, grp
+import errno, os, sys, stat, time, pwd, grp, socket
 from cStringIO import StringIO
 from bup import vint, xstat
 from bup.drecurse import recursive_dirlist
@@ -312,7 +312,11 @@ class Metadata:
             assert(self._recognized_file_type())
             os.mknod(path, 0600 | stat.S_IFIFO)
         elif stat.S_ISSOCK(self.mode):
-            os.mknod(path, 0600 | stat.S_IFSOCK)
+            if not sys.platform.startswith('cygwin'):
+                os.mknod(path, 0600 | stat.S_IFSOCK)
+            else:
+                s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
+                s.bind(path)
         elif stat.S_ISLNK(self.mode):
             assert(self._recognized_file_type())
             if self.symlink_target and create_symlinks: