[PATCH:libXau 1/5] Use configure check for pathconf instead of X_NOT_POSIX #define

Alan Coopersmith alan.coopersmith at oracle.com
Sat Mar 30 14:32:37 PDT 2013


Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 AuLock.c     |    7 +++----
 configure.ac |    4 ++++
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/AuLock.c b/AuLock.c
index 7bf9e5d..3ae7596 100644
--- a/AuLock.c
+++ b/AuLock.c
@@ -84,7 +84,7 @@ long	dead)
 		(void) close (creat_fd);
 	}
 	if (creat_fd != -1) {
-#ifndef X_NOT_POSIX
+#ifdef HAVE_PATHCONF
 	    /* The file system may not support hard links, and pathconf should tell us that. */
 	    if (1 == pathconf(creat_name, _PC_LINK_MAX)) {
 		if (-1 == rename(creat_name, link_name)) {
@@ -93,8 +93,9 @@ long	dead)
 		} else {
 		    return LOCK_SUCCESS;
 		}
-	    } else {
+	    } else
 #endif
+	    {
 	    	if (link (creat_name, link_name) != -1)
 		    return LOCK_SUCCESS;
 		if (errno == ENOENT) {
@@ -103,9 +104,7 @@ long	dead)
 	    	}
 	    	if (errno != EEXIST)
 		    return LOCK_ERROR;
-#ifndef X_NOT_POSIX
 	   }
-#endif
 	}
 	(void) sleep ((unsigned) timeout);
 	--retries;
diff --git a/configure.ac b/configure.ac
index 62a4717..e55cfce 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,6 +26,7 @@ AC_INIT([libXau], [1.0.7],
 	[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXau])
 AC_CONFIG_SRCDIR([Makefile.am])
 AC_CONFIG_HEADERS([config.h])
+AC_USE_SYSTEM_EXTENSIONS
 
 # Initialize Automake
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
@@ -43,6 +44,9 @@ XORG_DEFAULT_OPTIONS
 # Checks for programs.
 AC_PROG_LN_S
 
+# Checks for library functions.
+AC_CHECK_FUNCS([pathconf])
+
 # Obtain compiler/linker options for depedencies
 PKG_CHECK_MODULES(XAU, xproto)
 
-- 
1.7.9.2



More information about the xorg-devel mailing list