r3693: Correctly detect errno for no acl/ea support.
authorJeremy Allison <jra@samba.org>
Fri, 12 Nov 2004 02:16:00 +0000 (02:16 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:53:14 +0000 (10:53 -0500)
Jeremy

source/lib/sysacls.c
source/smbd/posix_acls.c

index 00d06e4a5aead067301bc9e8a707ef4d3e346400..9b5bef00e8acc1250112c63a6361cee850a34a03 100644 (file)
@@ -3196,3 +3196,23 @@ int sys_acl_free_qualifier(void *qual, SMB_ACL_TAG_T tagtype)
 }
 
 #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;
+}
index be7f828b677d432ce5882a6ca464b1d19376835d..0ba4437303de61236657f643a435f127704bc6fc 100644 (file)
@@ -245,7 +245,7 @@ static void store_inheritance_attributes(files_struct *fsp, canon_ace *file_ace_
        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 @@ static BOOL set_canon_ace_list(files_struct *fsp, canon_ace *the_ace, BOOL defau
 
        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,13 +2408,9 @@ static BOOL set_canon_ace_list(files_struct *fsp, canon_ace *the_ace, BOOL defau
                         * 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",
@@ -2427,13 +2423,9 @@ static BOOL set_canon_ace_list(files_struct *fsp, canon_ace *the_ace, BOOL defau
                         * 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) ));