From 92ff977ab2cfd22425240acf961f6ef332dc7f27 Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Sun, 26 May 2013 11:05:56 -0500 Subject: [PATCH] metadata.py: use socket() instead of mknod(...IF_SOCK) on Cygwin. 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 --- lib/bup/metadata.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/bup/metadata.py b/lib/bup/metadata.py index c317eee..384991e 100644 --- a/lib/bup/metadata.py +++ b/lib/bup/metadata.py @@ -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: -- 2.39.2