[PATCH] Re: crew fails to build on Solaris

Giorgos Keramidas keramida at ceid.upatras.gr
Thu Oct 11 14:30:45 UTC 2007


On 2007-10-11 17:16, Giorgos Keramidas <keramida at ceid.upatras.gr> wrote:
> Removing dirfd() on Solaris builds fixes things here for me, but I am
> not sure if this is the Right(TM) thing to do:

Here's a git-based patch, with the same change...

---------------------------------------------------------------------------
# HG changeset patch
# User Giorgos Keramidas <keramida at ceid.upatras.gr>
# Date 1192112972 -10800
# Node ID f3705c4e377859dca195e55a9e53d2ad12672217
# Parent  dad5d4e7f5f795b7fbd43a0112e9fdca8019eaf0
osutil.c: DIR->dd_fd is not a public interface on Solaris

Fall back to using lstat() on Solaris, to unbreak the build of
`mercurial/osutil.c'.  The fstatat() function is available on
Solaris too, but there seems to be no portable way to get the
file descriptor out of a DIR object.

diff --git a/mercurial/osutil.c b/mercurial/osutil.c
--- a/mercurial/osutil.c
+++ b/mercurial/osutil.c
@@ -16,10 +16,6 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-
-#if defined(__sun)
-#define dirfd(dir) ((dir)->dd_fd)
-#endif
 
 struct listdir_stat {
 	PyObject_HEAD
@@ -187,7 +183,7 @@ static PyObject *statfiles(PyObject *lis
 	int ret;
 	ssize_t i;
 	ssize_t size = PyList_Size(list);
-#ifdef AT_SYMLINK_NOFOLLOW
+#if defined(AT_SYMLINK_NOFOLLOW) && !defined(sun)
 	int dfd = dirfd(dir);
 #endif
 
@@ -213,7 +209,7 @@ static PyObject *statfiles(PyObject *lis
 			PyTuple_SET_ITEM(elt, 2, py_st);
 		}
 
-#ifdef AT_SYMLINK_NOFOLLOW
+#if defined(AT_SYMLINK_NOFOLLOW) && !defined(sun)
 		ret = fstatat(dfd, name, stp, AT_SYMLINK_NOFOLLOW);
 #else
 		ret = lstat(path, stp);
---------------------------------------------------------------------------



More information about the Mercurial-devel mailing list