tag 304264 patch thanks The attached patch should make darcs ignore sockets. I haven't tested it, though.
-- Matt
diff -ru darcs-1.0.3.orig/compat.c darcs-1.0.3/compat.c
--- darcs-1.0.3.orig/compat.c 2005-04-20 12:00:04.000000000 -0700
+++ darcs-1.0.3/compat.c 2005-07-28 07:49:52.929674416 -0700
@@ -194,6 +194,10 @@
return _pipe(fildes, 8 * (2<<10), O_BINARY);
}
+int is_socket(const char *file) {
+ return 0;
+}
+
int is_symlink(const char *file) {
return 0; /* FIXME: should ignore windows shortcuts */
}
@@ -294,6 +298,12 @@
#include <sys/types.h>
#include <sys/stat.h>
+int is_socket(const char *file) {
+ struct stat buf;
+ if (lstat(file, &buf)) return 0; /* treat error as non-socket */
+ return S_ISSOCK(buf.st_mode);
+}
+
int is_symlink(const char *file) {
struct stat buf;
if (lstat(file, &buf)) return 0; /* treat error as non-symlink */
diff -ru darcs-1.0.3.orig/compat.h darcs-1.0.3/compat.h
--- darcs-1.0.3.orig/compat.h 2005-03-18 05:12:16.000000000 -0800
+++ darcs-1.0.3/compat.h 2005-07-28 07:48:33.691720416 -0700
@@ -21,6 +21,7 @@
int execvp_no_vtalarm(const char *file, char *const argv[]);
+int is_socket(const char *file);
int is_symlink(const char *file);
int stdout_is_a_pipe();
diff -ru darcs-1.0.3.orig/SlurpDirectory.lhs darcs-1.0.3/SlurpDirectory.lhs
--- darcs-1.0.3.orig/SlurpDirectory.lhs 2005-03-18 05:12:16.000000000 -0800
+++ darcs-1.0.3/SlurpDirectory.lhs 2005-07-28 07:52:49.450839120 -0700
@@ -146,6 +146,14 @@
-- with older versions, though, we just ignore sleep's return
-- value. Hackery, like I said.
+foreign import ccall unsafe "static compat.h is_socket" is_socket
+ :: CString -> IO Int
+
+isFileReallySocket :: FilePath -> IO Bool
+isFileReallySocket f = do
+ withCString f $ \cf -> do sock <- is_socket cf
+ return $ sym /= 0
+
foreign import ccall unsafe "static compat.h is_symlink" is_symlink
:: CString -> IO Int
@@ -159,7 +167,9 @@
fe <- doesFileExist f
if not fe then return False
else do symlink <- isFileReallySymlink f
- return $ not symlink
+ if symlink then return False
+ else do socket <- isFileReallySocket f
+ return $ not socket
doesDirectoryReallyExist :: FilePath -> IO Bool
doesDirectoryReallyExist f = do
fe <- doesDirectoryExist f
signature.asc
Description: Digital signature

