Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2008-05-22 22:56:26 +0400
committerCorinna Vinschen <corinna@vinschen.de>2008-05-22 22:56:26 +0400
commit3ad8ec85469e01d3fc3e96479444c8094f70020a (patch)
tree245ac7a5f37eeafdd9442ac4a3a4128c6d82e829 /winsup/utils/setfacl.c
parentc1410a8d1ef1494e945c85cbe19903c2220547fe (diff)
* setfacl.c (setfacl): Change from void to int. Return 2 in case of
error. (main): Return with error code from setfacl.
Diffstat (limited to 'winsup/utils/setfacl.c')
-rw-r--r--winsup/utils/setfacl.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/winsup/utils/setfacl.c b/winsup/utils/setfacl.c
index deb0707f1..8dcce4a73 100644
--- a/winsup/utils/setfacl.c
+++ b/winsup/utils/setfacl.c
@@ -259,7 +259,7 @@ modacl (aclent_t *tgt, int tcnt, aclent_t *src, int scnt)
return tcnt;
}
-void
+int
setfacl (action_t action, char *path, aclent_t *acls, int cnt)
{
aclent_t lacl[MAX_ACL_ENTRIES];
@@ -269,13 +269,19 @@ setfacl (action_t action, char *path, aclent_t *acls, int cnt)
if (action == Set)
{
if (acl (path, SETACL, cnt, acls))
- perror (prog_name);
- return;
+ {
+ perror (prog_name);
+ return 2;
+ }
}
- if ((lcnt = acl (path, GETACL, MAX_ACL_ENTRIES, lacl)) < 0
+ else if ((lcnt = acl (path, GETACL, MAX_ACL_ENTRIES, lacl)) < 0
|| (lcnt = modacl (lacl, lcnt, acls, cnt)) < 0
|| (lcnt = acl (path, SETACL, lcnt, lacl)) < 0)
- perror (prog_name);
+ {
+ perror (prog_name);
+ return 2;
+ }
+ return 0;
}
static void
@@ -428,6 +434,7 @@ main (int argc, char **argv)
int ropt = 0;
aclent_t acls[MAX_ACL_ENTRIES];
int aclidx = 0;
+ int ret = 0;
prog_name = strrchr (argv[0], '/');
if (prog_name == NULL)
@@ -561,6 +568,6 @@ main (int argc, char **argv)
break;
}
for (c = optind; c < argc; ++c)
- setfacl (action, argv[c], acls, aclidx);
- return 0;
+ ret |= setfacl (action, argv[c], acls, aclidx);
+ return ret;
}