[patch] ATTR_MAX_VALUELEN on AIX with IBM C compiler

James Flemer jflemer at uvm.edu
Thu Jan 1 21:09:43 GMT 2004


When configuring Samba 3.0.0 on AIX 5.1 with the IBM C compiler
(cc/xlc/cc_r/xlc_r), the function attr_list() is detected
causing HAVE_ATTR_LIST to be defined.  However, sys/attributes.h
is not detected and thus HAVE_SYS_ATTRIBUTES_H is not defined.

When compiling, source/lib/system.c fails to compile because
ATTR_MAX_VALUELEN is not defined.  This macro, I belive, is
defined in sys/attributes.h on systems that have such a header.
Consequently, the preprocessor conditionals in lib/system.c
should me modified to require HAVE_SYS_ATTRIBUTES_H before
trying to use attr_list().  The included patch allows system.c
to compile with the IBM C compiler on AIX 5.1.

The patch is against samba-3.0.0, but I expect would apply to
3.0.1, as well as cvs head, since this file has not changed much
since 3.0.0.

-James

--- source/lib/system.c.orig	Thu Jan  1 15:12:39 2004
+++ source/lib/system.c	Thu Jan  1 15:13:11 2004
@@ -1319,7 +1319,7 @@
 #endif
 }
 
-#if defined(HAVE_ATTR_LIST)
+#if defined(HAVE_ATTR_LIST) && defined(HAVE_SYS_ATTRIBUTES_H)
 static char attr_buffer[ATTR_MAX_VALUELEN];
 
 static ssize_t irix_attr_list(const char *path, int filedes, char *list, size_t size, int flags)
@@ -1391,7 +1391,7 @@
 {
 #if defined(HAVE_LISTXATTR)
 	return listxattr(path, list, size);
-#elif defined(HAVE_ATTR_LIST)
+#elif defined(HAVE_ATTR_LIST) && defined(HAVE_SYS_ATTRIBUTES_H)
 	return irix_attr_list(path, 0, list, size, 0);
 #else
 	errno = ENOSYS;
@@ -1403,7 +1403,7 @@
 {
 #if defined(HAVE_LLISTXATTR)
 	return llistxattr(path, list, size);
-#elif defined(HAVE_ATTR_LIST)
+#elif defined(HAVE_ATTR_LIST) && defined(HAVE_SYS_ATTRIBUTES_H)
 	return irix_attr_list(path, 0, list, size, ATTR_DONTFOLLOW);
 #else
 	errno = ENOSYS;


More information about the samba-technical mailing list