summaryrefslogtreecommitdiff
path: root/lib/get-permissions.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2018-06-29 17:31:04 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2018-06-29 17:32:35 -0700
commit35e9dcab5141bf9cae67abe740933fe627ecc371 (patch)
tree2813d1f6340df34a97695874e5546e4b2454d555 /lib/get-permissions.c
parent2e2811865f0adb6658a87d3581a2dc3a9022f451 (diff)
downloademacs-35e9dcab5141bf9cae67abe740933fe627ecc371.tar.gz
Update from Gnulib
This incorporates: 2018-06-29 regex: glibc does not use intprops.h 2018-06-28 regex: port to recently proposed glibc regex merge 2018-06-25 Continue to use spaces for indentation, not tabs 2018-06-25 manywarnings: Don't enable -Wjump-misses-init by default 2018-06-25 acl-internal.h: remove _GL_ATTRIBUTE_CONST on void function 2018-06-24 manywarnings: accommodate GCC 9: remove -Wchkp and -Wabi 2018-06-24 maint: clarify comments about sticky EOF 2018-06-24 af_alg: avoid hangs when reading from streams 2018-06-17 crypto: use byteswap 2018-06-17 getloadavg: Return 0 on MS-Windows without Cygwi 2018-06-17 getloadavg: Allow building on MS-Windows without Cygwin * build-aux/config.guess, build-aux/config.sub, doc/misc/texinfo.tex: * lib/acl-internal.c, lib/acl-internal.h, lib/get-permissions.c: * lib/getloadavg.c, lib/gettimeofday.c, lib/md5.c, lib/pselect.c: * lib/set-permissions.c, lib/sha1.c, lib/sha256.c, lib/sha512.c: * lib/time.in.h, m4/getloadavg.m4, m4/gnulib-common.m4: * m4/manywarnings.m4, m4/pthread_sigmask.m4, m4/vararrays.m4: Copy from Gnulib.
Diffstat (limited to 'lib/get-permissions.c')
-rw-r--r--lib/get-permissions.c88
1 files changed, 44 insertions, 44 deletions
diff --git a/lib/get-permissions.c b/lib/get-permissions.c
index bb1af5dbdfc..83ba2639a17 100644
--- a/lib/get-permissions.c
+++ b/lib/get-permissions.c
@@ -31,7 +31,7 @@
int
get_permissions (const char *name, int desc, mode_t mode,
- struct permission_context *ctx)
+ struct permission_context *ctx)
{
memset (ctx, 0, sizeof *ctx);
ctx->mode = mode;
@@ -57,7 +57,7 @@ get_permissions (const char *name, int desc, mode_t mode,
{
ctx->default_acl = acl_get_file (name, ACL_TYPE_DEFAULT);
if (ctx->default_acl == NULL)
- return -1;
+ return -1;
}
# if HAVE_ACL_TYPE_NFS4 /* FreeBSD */
@@ -115,16 +115,16 @@ get_permissions (const char *name, int desc, mode_t mode,
int ret;
if (desc != -1)
- ret = facl (desc, ACE_GETACLCNT, 0, NULL);
+ ret = facl (desc, ACE_GETACLCNT, 0, NULL);
else
- ret = acl (name, ACE_GETACLCNT, 0, NULL);
+ ret = acl (name, ACE_GETACLCNT, 0, NULL);
if (ret < 0)
- {
- if (errno == ENOSYS || errno == EINVAL)
- ret = 0;
- else
- return -1;
- }
+ {
+ if (errno == ENOSYS || errno == EINVAL)
+ ret = 0;
+ else
+ return -1;
+ }
ctx->ace_count = ret;
if (ctx->ace_count == 0)
@@ -138,15 +138,15 @@ get_permissions (const char *name, int desc, mode_t mode,
}
if (desc != -1)
- ret = facl (desc, ACE_GETACL, ctx->ace_count, ctx->ace_entries);
+ ret = facl (desc, ACE_GETACL, ctx->ace_count, ctx->ace_entries);
else
- ret = acl (name, ACE_GETACL, ctx->ace_count, ctx->ace_entries);
+ ret = acl (name, ACE_GETACL, ctx->ace_count, ctx->ace_entries);
if (ret < 0)
{
if (errno == ENOSYS || errno == EINVAL)
{
- free (ctx->ace_entries);
- ctx->ace_entries = NULL;
+ free (ctx->ace_entries);
+ ctx->ace_entries = NULL;
ctx->ace_count = 0;
break;
}
@@ -154,10 +154,10 @@ get_permissions (const char *name, int desc, mode_t mode,
return -1;
}
if (ret <= ctx->ace_count)
- {
- ctx->ace_count = ret;
- break;
- }
+ {
+ ctx->ace_count = ret;
+ break;
+ }
/* Huh? The number of ACL entries has increased since the last call.
Repeat. */
free (ctx->ace_entries);
@@ -170,20 +170,20 @@ get_permissions (const char *name, int desc, mode_t mode,
int ret;
if (desc != -1)
- ret = facl (desc, GETACLCNT, 0, NULL);
+ ret = facl (desc, GETACLCNT, 0, NULL);
else
- ret = acl (name, GETACLCNT, 0, NULL);
+ ret = acl (name, GETACLCNT, 0, NULL);
if (ret < 0)
- {
- if (errno == ENOSYS || errno == ENOTSUP || errno == EOPNOTSUPP)
- ret = 0;
- else
- return -1;
- }
+ {
+ if (errno == ENOSYS || errno == ENOTSUP || errno == EOPNOTSUPP)
+ ret = 0;
+ else
+ return -1;
+ }
ctx->count = ret;
if (ctx->count == 0)
- break;
+ break;
ctx->entries = (aclent_t *) malloc (ctx->count * sizeof (aclent_t));
if (ctx->entries == NULL)
@@ -193,26 +193,26 @@ get_permissions (const char *name, int desc, mode_t mode,
}
if (desc != -1)
- ret = facl (desc, GETACL, ctx->count, ctx->entries);
+ ret = facl (desc, GETACL, ctx->count, ctx->entries);
else
- ret = acl (name, GETACL, ctx->count, ctx->entries);
+ ret = acl (name, GETACL, ctx->count, ctx->entries);
if (ret < 0)
- {
- if (errno == ENOSYS || errno == ENOTSUP || errno == EOPNOTSUPP)
- {
- free (ctx->entries);
- ctx->entries = NULL;
- ctx->count = 0;
- break;
- }
- else
- return -1;
- }
+ {
+ if (errno == ENOSYS || errno == ENOTSUP || errno == EOPNOTSUPP)
+ {
+ free (ctx->entries);
+ ctx->entries = NULL;
+ ctx->count = 0;
+ break;
+ }
+ else
+ return -1;
+ }
if (ret <= ctx->count)
- {
- ctx->count = ret;
- break;
- }
+ {
+ ctx->count = ret;
+ break;
+ }
/* Huh? The number of ACL entries has increased since the last call.
Repeat. */
free (ctx->entries);