aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert2015-05-29 12:42:59 -0700
committerPaul Eggert2015-05-29 12:43:31 -0700
commit56b4b0e72e15911da89f8935351a1840905c8eae (patch)
tree39781f63cd6fd691e2cdef7421ef6d5fd8539562 /lib
parent0a539105a88820548b2038251eb174026341150e (diff)
downloademacs-56b4b0e72e15911da89f8935351a1840905c8eae.tar.gz
emacs-56b4b0e72e15911da89f8935351a1840905c8eae.zip
Merge from gnulib
This incorporates the following (Bug#20681): 2015-05-29 acl-permissions: Fix build on Mac OS X and older AIX 2015-05-29 acl-permissions: Fix build on Solaris and Cygwin * lib/set-permissions.c: Copy from gnulib.
Diffstat (limited to 'lib')
-rw-r--r--lib/set-permissions.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/set-permissions.c b/lib/set-permissions.c
index 47cb91ca162..ba291f316f6 100644
--- a/lib/set-permissions.c
+++ b/lib/set-permissions.c
@@ -566,7 +566,7 @@ set_acls (struct permission_context *ctx, const char *name, int desc,
566 { 566 {
567 acl_free (acl); 567 acl_free (acl);
568 568
569 acl = acl_init (acl); 569 acl = acl_init (0);
570 if (acl) 570 if (acl)
571 { 571 {
572 if (HAVE_ACL_SET_FD && desc != -1) 572 if (HAVE_ACL_SET_FD && desc != -1)
@@ -582,12 +582,13 @@ set_acls (struct permission_context *ctx, const char *name, int desc,
582 else 582 else
583 { 583 {
584 if (HAVE_ACL_SET_FD && desc != -1) 584 if (HAVE_ACL_SET_FD && desc != -1)
585 ret = acl_set_fd (desc, acl); 585 ret = acl_set_fd (desc, ctx->acl);
586 else 586 else
587 ret = acl_set_file (name, ACL_TYPE_EXTENDED, acl); 587 ret = acl_set_file (name, ACL_TYPE_EXTENDED, ctx->acl);
588 if (ret != 0) 588 if (ret != 0)
589 { 589 {
590 if (! acl_errno_valid (saved_errno) && ! acl_extended_nontrivial (acl)) 590 if (! acl_errno_valid (errno)
591 && ! acl_extended_nontrivial (ctx->acl))
591 ret = 0; 592 ret = 0;
592 } 593 }
593 } 594 }
@@ -611,13 +612,13 @@ set_acls (struct permission_context *ctx, const char *name, int desc,
611 if (ret == 0 && ctx->count) 612 if (ret == 0 && ctx->count)
612 { 613 {
613 if (desc != -1) 614 if (desc != -1)
614 ret = facl (desc, SETACL, count, entries); 615 ret = facl (desc, SETACL, ctx->count, ctx->entries);
615 else 616 else
616 ret = acl (name, SETACL, count, entries); 617 ret = acl (name, SETACL, ctx->count, ctx->entries);
617 if (ret < 0) 618 if (ret < 0)
618 { 619 {
619 if ((errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL) 620 if ((errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL)
620 && acl_nontrivial (count, entries) == 0) 621 && acl_nontrivial (ctx->count, ctx->entries) == 0)
621 ret = 0; 622 ret = 0;
622 } 623 }
623 else 624 else
@@ -628,13 +629,13 @@ set_acls (struct permission_context *ctx, const char *name, int desc,
628 if (ret == 0 && ctx->ace_count) 629 if (ret == 0 && ctx->ace_count)
629 { 630 {
630 if (desc != -1) 631 if (desc != -1)
631 ret = facl (desc, ACE_SETACL, ace_count, ace_entries); 632 ret = facl (desc, ACE_SETACL, ctx->ace_count, ctx->ace_entries);
632 else 633 else
633 ret = acl (name, ACE_SETACL, ace_count, ace_entries); 634 ret = acl (name, ACE_SETACL, ctx->ace_count, ctx->ace_entries);
634 if (ret < 0) 635 if (ret < 0)
635 { 636 {
636 if ((errno == ENOSYS || errno == EINVAL || errno == ENOTSUP) 637 if ((errno == ENOSYS || errno == EINVAL || errno == ENOTSUP)
637 && acl_ace_nontrivial (ace_count, ace_entries) == 0) 638 && acl_ace_nontrivial (ctx->ace_count, ctx->ace_entries) == 0)
638 ret = 0; 639 ret = 0;
639 } 640 }
640 else 641 else
@@ -696,9 +697,9 @@ set_acls (struct permission_context *ctx, const char *name, int desc,
696 if (ret == 0 && ctx->have_u) 697 if (ret == 0 && ctx->have_u)
697 { 698 {
698 if (desc != -1) 699 if (desc != -1)
699 ret = fchacl (desc, &u.a, u.a.acl_len); 700 ret = fchacl (desc, &ctx->u.a, ctx->u.a.acl_len);
700 else 701 else
701 ret = chacl (name, &u.a, u.a.acl_len); 702 ret = chacl (name, &ctx->u.a, ctx->u.a.acl_len);
702 if (ret < 0) 703 if (ret < 0)
703 { 704 {
704 if (errno == ENOSYS && from_mode) 705 if (errno == ENOSYS && from_mode)