Some build problem on Solaris (v3-2-test)

Tomoki AONO aono at cc.osaka-kyoiku.ac.jp
Sun Nov 25 01:59:40 GMT 2007


I found difficulties building Samba on Solaris 9
environment:

1. lib/system.c (xattr code for Solaris) could not be
built against c90 compilers. (declaration after
statement.) Sample patch attached.

2. lib/replace/system/network.h : Macro definition of
ifr_netmask may be wrong. Jerry wrote to this list before
(http://lists.samba.org/archive/samba-technical/2007-October/056280.html
, I forgot Message-Id.), but code he wrote differs from
his explanation after it. It should be ifr_addr (not
ifr_addrs).

3. Although above modification, lib/interfaces.c test on
configure fails (as a result, we cannot use any interface
detection method ).

3-1. Solaris 9 (and other IPv6 ready versions) needs
-lsocket (and -lnsl?) for getaddrinfo(), but test in
lib/replace/getaddrinfo.m4 executes before library
detection. So AC_TRY_LINK() always fails.

3-2. Platform that doesn't have getaddrinfo() needs
libreplace code, but test main() function in
lib/interfaces.c uses getnameinfo() without linking them
(rep_getnameinfo() and other libreplace functions (on my
environment, rep_snprintf() )).

Sample patch against 1. followes:

diff --git a/source/lib/system.c b/source/lib/system.c
index 7338ea7..5013cc5 100644
--- a/source/lib/system.c
+++ b/source/lib/system.c
@@ -1990,9 +1990,10 @@ int sys_setxattr (const char *path, const char *name, const void *value, size_t
 #elif defined(HAVE_ATTROPEN)
 	int ret = -1;
 	int myflags = O_RDWR;
+	int attrfd;
 	if (flags & XATTR_CREATE) myflags |= O_EXCL;
 	if (!(flags & XATTR_REPLACE)) myflags |= O_CREAT;
-	int attrfd = solaris_attropen(path, name, myflags, (mode_t) SOLARIS_ATTRMODE);
+	attrfd = solaris_attropen(path, name, myflags, (mode_t) SOLARIS_ATTRMODE);
 	if (attrfd >= 0) {
 		ret = solaris_write_xattr(attrfd, value, size);
 		close(attrfd);
@@ -2053,9 +2054,10 @@ int sys_lsetxattr (const char *path, const char *name, const void *value, size_t
 #elif defined(HAVE_ATTROPEN)
 	int ret = -1;
 	int myflags = O_RDWR | AT_SYMLINK_NOFOLLOW;
+	int attrfd;
 	if (flags & XATTR_CREATE) myflags |= O_EXCL;
 	if (!(flags & XATTR_REPLACE)) myflags |= O_CREAT;
-	int attrfd = solaris_attropen(path, name, myflags, (mode_t) SOLARIS_ATTRMODE);
+	attrfd = solaris_attropen(path, name, myflags, (mode_t) SOLARIS_ATTRMODE);
 	if (attrfd >= 0) {
 		ret = solaris_write_xattr(attrfd, value, size);
 		close(attrfd);
@@ -2117,9 +2119,10 @@ int sys_fsetxattr (int filedes, const char *name, const void *value, size_t size
 #elif defined(HAVE_ATTROPEN)
 	int ret = -1;
 	int myflags = O_RDWR | O_XATTR;
+	int attrfd;
 	if (flags & XATTR_CREATE) myflags |= O_EXCL;
 	if (!(flags & XATTR_REPLACE)) myflags |= O_CREAT;
-	int attrfd = solaris_openat(filedes, name, myflags, (mode_t) SOLARIS_ATTRMODE);
+	attrfd = solaris_openat(filedes, name, myflags, (mode_t) SOLARIS_ATTRMODE);
 	if (attrfd >= 0) {
 		ret = solaris_write_xattr(attrfd, value, size);
 		close(attrfd);

----
Tomoki AONO	(aono at cc.osaka-kyoiku.ac.jp)


More information about the samba-technical mailing list