qacl: port to Windows better
[gnulib.git] / lib / file-has-acl.c
index 16380e3..53ac317 100644 (file)
@@ -1,6 +1,6 @@
 /* Test whether a file has a nontrivial access control list.
 
-   Copyright (C) 2002-2003, 2005-2012 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003, 2005-2013 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -75,8 +75,7 @@ acl_access_nontrivial (acl_t acl)
     }
   return got_one;
 
-#  else /* IRIX, Tru64 */
-#   if HAVE_ACL_TO_SHORT_TEXT /* IRIX */
+#  elif HAVE_ACL_TO_SHORT_TEXT /* IRIX */
   /* Don't use acl_get_entry: it is undocumented.  */
 
   int count = acl->acl_cnt;
@@ -93,8 +92,7 @@ acl_access_nontrivial (acl_t acl)
     }
   return 0;
 
-#   endif
-#   if HAVE_ACL_FREE_TEXT /* Tru64 */
+#  elif HAVE_ACL_FREE_TEXT /* Tru64 */
   /* Don't use acl_get_entry: it takes only one argument and does not work.  */
 
   int count = acl->acl_num;
@@ -117,7 +115,10 @@ acl_access_nontrivial (acl_t acl)
     }
   return 0;
 
-#   endif
+#  else
+
+  errno = ENOSYS;
+  return -1;
 #  endif
 }
 
@@ -553,7 +554,7 @@ file_has_acl (char const *name, struct stat const *sb)
 #  endif
         }
       if (ret < 0)
-        return ACL_NOT_WELL_SUPPORTED (errno) ? 0 : -1;
+        return - acl_errno_valid (errno);
       return ret;
 
 # elif HAVE_FACL && defined GETACL /* Solaris, Cygwin, not HP-UX */