lib/set-permissions.c


Log

Author Commit Date CI Message
Bruno Haible d7cf3b8d 2018-06-25T21:45:23 Continue to use spaces for indentation, not tabs.
Paul Eggert 281b825e 2018-01-01T00:57:25 maint: Run 'make update-copyright'
Paul Eggert ca35d468 2017-09-13T00:48:18 all: prefer https: URLs
Paul Eggert a3fd683d 2017-01-01T02:59:23 version-etc: new year * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
Eric Blake bdb72bc6 2016-03-08T15:35:30 acl: fix missing return on Cygwin Compilation on Cygwin 2.4.1 resulted in an 'install' that behaved differently depending on compile-time flags; I traced it to this warning, where the difference was based on what was left in the return register: lib/set-permissions.c: In function 'set_acls_from_mode': lib/set-permissions.c:273:1: warning: control reaches end of non-void function [-Wreturn-type] * lib/set-permissions.c (set_acls) [HAVE_FACL && GETACL]: Don't fall off end of function. Fixes http://bugs.gnu.org/22949 Signed-off-by: Eric Blake <eblake@redhat.com>
Paul Eggert 71090a2a 2016-01-01T00:56:19 version-etc: new year * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
Paul Eggert f406941a 2015-09-24T13:22:23 maint: add coding cookies to non-ASCII sources Otherwise, Emacs might do the wrong thing if run in an he_IL.ISO-8859-8 locale, which an Emacs developer does on occasion. Problem reported by Eli Zaretskii in: http://lists.gnu.org/archive/html/emacs-devel/2015-09/msg00966.html Don't bother with test files, as they aren't copied to the Emacs source directory. If this problem affects test files in some other GNU project, we can add coding cookies to the non-ASCII test files later.
Andreas Gruenbacher 090526e7 2015-07-05T22:46:11 acl-permissions: Document FreeBSD ACL_TYPE_NFS4 acls * lib/set-permissions.c (set_acls): Document where support for FreeBSD ACL_TYPE_NFS4 acls should go. * lib/get-permissions.c (get_permissions): Likewise.
Andreas Gruenbacher da97e2a5 2015-06-30T21:09:28 acl-permissions: Fix on FreeBSD When a directory doesn't have an ACL_TYPE_DEFAULT acl, acl_get_file will return an empty acl, but when trying to set that acl, FreeBSD's acl_set_file will fail with errno == EINVAL. Instead, FreeBSD expects acl_delete_def_file to be used. * lib/acl-internal.c (acl_default_nontrivial): Recognize empty default acls. * lib/set-permissions.c (set_acls): Avoid calling acl_set_file for empty ACL_TYPE_DEFAULT acls.
Andreas Gruenbacher 999724c0 2015-06-30T21:09:28 file-has-acl, acl-permissions: fix some more HP-UX typos Problem reported by John David Anglin in: http://bugs.gnu.org/20979 * lib/set-permissions.c (context_acl_from_mode): Fix some more obvious typos introduced by the recent ACL changes.
Paul Eggert f4664046 2015-07-04T11:05:00 file-has-acl, acl-permissions: fix HP-UX typos Problem reported by John David Anglin in: http://bugs.gnu.org/20979 * lib/file-has-acl.c (file_has_acl): * lib/set-permissions.c (context_acl_from_mode) (context_aclv_from_mode, set_acls): Fix some obvious typos when HAVE_GETCL /* HP-UX */. They were introduced by the recent ACL changes.
Jim Meyering 7a4daa4d 2015-07-03T14:58:19 set-permissions.c: adjust acl_from_mode's cpp guard * lib/set-permissions.c (acl_from_mode): Guard with #ifdef directives identical to those guarding the sole use. Otherwise, on some systems, we'd get a warning about the function being defined but not used. Also, filter through cppi to correct misleading indentation of cpp directives.
Pádraig Brady 716083c1 2015-06-30T20:35:26 acl: fix definition of acl_from_mode on FreeBSD This was causing basic coreutils copy operations to fail with ENOTSUP or ENOENT error messages. * lib/acl-internal.h (acl_from_mode): Only define when ! defined HAVE_ACL_FROM_TEXT. That allows the version of acl_from_mode() defined in lib/set-permissions.c to be used on FreeBSD at least. * lib/set-permissions.c: Fix up comment spelling, and a redundant variable assignment; noticed in passing.
Paul Eggert 82990bb4 2015-06-14T22:50:18 * lib/set-permissions.c: Spelling fix.
Paul Eggert ecabc6b0 2015-06-05T11:47:37 acl-permissions: more porting to AIX * lib/file-has-acl.c (file_has_acl) [HAVE_STATACL]: * lib/readutmp.c (read_utmp) [UTMP_NAME_FUNCTION]: * lib/set-permissions.c (set_acls) [HAVE_ACLX_GET && ACL_AIX_WIP]: Add cast for AIX, whose system calls are declared to accept char * even though the arguments are really char const *. * lib/mountlist.c (read_file_system_list) [MOUNTED_VMOUNT]: Rework types to pacify xlc.
Andreas Gruenbacher 04e44583 2015-05-29T20:47:45 acl-permissions: Fix build on Mac OS X and older AIX (Bug#20681) * lib/set-permissions.c (set_acls): Fix more errors introduced in the acl module rewrite.
Andreas Gruenbacher 188c4b49 2015-05-29T19:47:40 acl-permissions: Fix build on Solaris and Cygwin Reported by Tom G. Christensen <tgc@jupiterrise.com>: * lib/set-permissions.c (set_acls): The count, entries, ace_count, and ace_entries variables have moved into struct permission_context but they were still accessed as local variables here.
Andreas Gruenbacher 2d5ce445 2015-04-11T14:44:30 qacl: Reimplement qset_acl and qcopy_acl (Bug#20666) Implement get_permissions and set_permissions primitives for getting all the permissions of a file, storing them, and later setting them. (In the minimal case, the permissions consist only of a file mode.) Reimplement qset_acl and qcopy_acl based on these new primitives: this avoids code duplication and makes error handling more consistent. The Solaris and Cygwin code still uses duplicate code paths for setting a file mode while making sure that no acls exist and setting an explicit acl; this is no worse than before, but could be cleaned up. The AIX code still doesn't read ACLs, it only makes sure that acls don't get in the way when setting a file mode. * lib/acl-internal.h (struct permission_context): New data structure. (get_permissions, set_permissions, free_permission_context): Declare. * lib/acl-internal.c (free_permission_context): New helper function. * lib/get-permissions.c (get_permissions): New helper function split off from qcopy_acl. * lib/set-permissions.c: (set_acls_from_mode): On Solaris, Cygwin, and AIX, set a file's permissions based only on a file mode. (acl_from_mode, context_acl_from_mode, context_aclv_from_mode): All other platforms construct a temporary acl from the file mode and set that acl in the same way as setting an acl read from the source file. This should help avoid code duplication and inconsistent / buggy behavior. (set_acls): New helper function Split off from qcopy_acl. (chmod_or_fchmod): Moved here from qset-acl.c. (set_permissions): New helper function. * lib/qcopy-acl.c (qcopy_acl): Rewrite using get_permissions and set_permissions. * lib/qset-acl.c (qset_acl): Rewrite using set_permissions. * modules/qacl: Add get-permissions.c and set-permissions.c.