svn commit: samba r3692 - in trunk/source: lib smbd

jra at samba.org jra at samba.org
Fri Nov 12 02:15:56 GMT 2004


Author: jra
Date: 2004-11-12 02:15:55 +0000 (Fri, 12 Nov 2004)
New Revision: 3692

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=3692

Log:
Correctly detect errno for no acl/ea support.
Jeremy

Modified:
   trunk/source/lib/sysacls.c
   trunk/source/smbd/posix_acls.c


Changeset:
Modified: trunk/source/lib/sysacls.c
===================================================================
--- trunk/source/lib/sysacls.c	2004-11-12 02:00:58 UTC (rev 3691)
+++ trunk/source/lib/sysacls.c	2004-11-12 02:15:55 UTC (rev 3692)
@@ -3196,3 +3196,23 @@
 }
 
 #endif /* No ACLs. */
+
+/************************************************************************
+ Deliberately outside the ACL defines. Return 1 if this is a "no acls"
+ errno, 0 if not.
+************************************************************************/
+
+int no_acl_syscall_error(int err)
+{
+#if defined(ENOSYS)
+	if (err == ENOSYS) {
+		return 1;
+	}
+#endif
+#if defined(ENOTSUP)
+	if (err == ENOTSUP) {
+		return 1;
+	}
+#endif
+	return 0;
+}

Modified: trunk/source/smbd/posix_acls.c
===================================================================
--- trunk/source/smbd/posix_acls.c	2004-11-12 02:00:58 UTC (rev 3691)
+++ trunk/source/smbd/posix_acls.c	2004-11-12 02:15:55 UTC (rev 3692)
@@ -245,7 +245,7 @@
 	SAFE_FREE(pai_buf);
 
 	DEBUG(10,("store_inheritance_attribute:%s for file %s\n", protected ? " (protected)" : "", fsp->fsp_name));
-	if (ret == -1 && errno != ENOSYS)
+	if (ret == -1 && !no_acl_syscall_error(errno))
 		DEBUG(1,("store_inheritance_attribute: Error %s\n", strerror(errno) ));
 }
 
@@ -2243,7 +2243,7 @@
 
 	if (the_acl == NULL) {
 
-		if (errno != ENOSYS) {
+		if (!no_acl_syscall_error(errno)) {
 			/*
 			 * Only print this error message if we have some kind of ACL
 			 * support that's not working. Otherwise we would always get this.
@@ -2408,14 +2408,10 @@
 			 * Some systems allow all the above calls and only fail with no ACL support
 			 * when attempting to apply the acl. HPUX with HFS is an example of this. JRA.
 			 */
-			if (errno == ENOSYS)
+			if (no_acl_syscall_error(errno)) {
 				*pacl_set_support = False;
+			}
 
-#ifdef ENOTSUP
-			if (errno == ENOTSUP)
-				*pacl_set_support = False;
-#endif
-
 			DEBUG(2,("set_canon_ace_list: sys_acl_set_file type %s failed for file %s (%s).\n",
 					the_acl_type == SMB_ACL_TYPE_DEFAULT ? "directory default" : "file",
 					fsp->fsp_name, strerror(errno) ));
@@ -2427,14 +2423,10 @@
 			 * Some systems allow all the above calls and only fail with no ACL support
 			 * when attempting to apply the acl. HPUX with HFS is an example of this. JRA.
 			 */
-			if (errno == ENOSYS)
+			if (no_acl_syscall_error(errno)) {
 				*pacl_set_support = False;
+			}
 
-#ifdef ENOTSUP
-			if (errno == ENOTSUP)
-				*pacl_set_support = False;
-#endif
-
 			DEBUG(2,("set_canon_ace_list: sys_acl_set_file failed for file %s (%s).\n",
 					fsp->fsp_name, strerror(errno) ));
 			goto done;



More information about the samba-cvs mailing list