https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=004d8adfa27232067aa67c2eb9aba0d29a11b2fd

commit 004d8adfa27232067aa67c2eb9aba0d29a11b2fd
Author: Corinna Vinschen <cori...@vinschen.de>
Date:   Wed Mar 13 12:06:48 2019 +0100

    Cygwin: acls: allow converting empty acl to text
    
    Signed-off-by: Corinna Vinschen <cori...@vinschen.de>

Diff:
---
 winsup/cygwin/release/3.0.4 | 3 +++
 winsup/cygwin/sec_acl.cc    | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/release/3.0.4 b/winsup/cygwin/release/3.0.4
index e6632f4..eeed283 100644
--- a/winsup/cygwin/release/3.0.4
+++ b/winsup/cygwin/release/3.0.4
@@ -14,3 +14,6 @@ Bug Fixes
 
 - Fix access to process list
   Addresses: https://cygwin.com/ml/cygwin/2019-03/msg00253.html
+
+- Fix acl_to_text/acl_to_any_text returning EINVAL on empty acl
+  Addresses: https://cygwin.com/ml/cygwin/2019-03/msg00157.html
diff --git a/winsup/cygwin/sec_acl.cc b/winsup/cygwin/sec_acl.cc
index ce7910e..933bfa6 100644
--- a/winsup/cygwin/sec_acl.cc
+++ b/winsup/cygwin/sec_acl.cc
@@ -1638,8 +1638,8 @@ char *
 __acltotext (aclent_t *aclbufp, int aclcnt, const char *prefix, char separator,
             int options)
 {
-  if (!aclbufp || aclcnt < 1 || aclcnt > MAX_ACL_ENTRIES
-      || aclsort32 (aclcnt, 0, aclbufp))
+  if (!aclbufp || aclcnt < 0 || aclcnt > MAX_ACL_ENTRIES
+      || (aclcnt > 0 && aclsort32 (aclcnt, 0, aclbufp)))
     {
       set_errno (EINVAL);
       return NULL;

Reply via email to