summaryrefslogtreecommitdiff
path: root/lib/set-permissions.c
Commit message (Collapse)AuthorAgeFilesLines
* gnulib-common.m4: Use C2x [[maybe_unused]] when possible.Bruno Haible2021-08-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * m4/gnulib-common.m4 (gl_COMMON_BODY): Define _GL_UNUSED as an alias of _GL_ATTRIBUTE_MAYBE_UNUSED, not of _GL_ATTRIBUTE_UNUSED. * lib/binary-io.h (__gl_setmode): Put _GL_UNUSED before, not after, the declaration. * lib/c-stack.c (null_action, segv_handler, overflow_handler, c_stack_action): Likewise. * lib/chown.c (chown): Likewise. * lib/clean-temp-simple.c (cleanup_action): Likewise. * lib/fts.c (dirent_inode_sort_may_be_useful, leaf_optimization, fts_set): Likewise. * lib/getgroups.c (getgroups): Likewise. * lib/getopt.c (_getopt_initialize): Likewise. * lib/getugroups.c (getugroups): Likewise. * lib/localename.c (gl_locale_name_thread_unsafe, gl_locale_name_thread, gl_locale_name_posix, gl_locale_name_environ): Likewise. * lib/mkdir.c (rpl_mkdir): Likewise. * lib/mkfifo.c (mkfifo): Likewise. * lib/mkfifoat.c (mkfifoat): Likewise. * lib/mknod.c (mknod): Likewise. * lib/mknodat.c (mknodat): Likewise. * lib/mountlist.c (me_remote): Likewise. * lib/openpty.c (openpty): Likewise. * lib/parse-datetime.y (yyerror): Likewise. * lib/passfd.c (sendfd, recvfd): Likewise. * lib/pthread-cond.c (pthread_condattr_destroy, pthread_cond_init, pthread_cond_wait, pthread_cond_timedwait, pthread_cond_signal, pthread_cond_broadcast, pthread_cond_destroy): Likewise. * lib/pthread-mutex.c (pthread_mutexattr_destroy, pthread_mutex_init, pthread_mutex_lock, pthread_mutex_trylock, pthread_mutex_timedlock, pthread_mutex_unlock, pthread_mutex_destroy): Likewise. * lib/pthread-rwlock.c (pthread_rwlockattr_destroy, pthread_rwlock_init, pthread_rwlock_timedrdlock, pthread_rwlock_timedwrlock): Likewise. * lib/pthread-spin.c (pthread_spin_init, pthread_spin_lock, pthread_spin_trylock, pthread_spin_unlock, pthread_spin_destroy): Likewise. * lib/pthread-thread.c (pthread_attr_destroy): Likewise. * lib/readlink.c (readlink): Likewise. * lib/rename.c (rpl_rename): Likewise. * lib/set-permissions.c (set_permissions): Likewise. * lib/sockets.c (gl_sockets_startup): Likewise. * lib/stat-time.h (get_stat_birthtime_ns, get_stat_birthtime, stat_time_normalize): Likewise. * lib/strptime.c (__strptime_internal): Likewise. * lib/strtod.c (LDEXP): Likewise. * lib/symlink.c (symlink): Likewise. * lib/symlinkat.c (symlinkat): Likewise. * lib/tempname.c (try_dir, try_nocreate): Likewise. * lib/textstyle.in.h (styled_ostream_begin_use_class, styled_ostream_end_use_class, styled_ostream_get_hyperlink_ref, styled_ostream_get_hyperlink_id, styled_ostream_set_hyperlink, styled_ostream_flush_to_current_style, fd_ostream_create, term_ostream_get_color, term_ostream_set_color, term_ostream_get_bgcolor, term_ostream_set_bgcolor, term_ostream_get_weight, term_ostream_set_weight, term_ostream_get_posture, term_ostream_set_posture, term_ostream_get_underline, term_ostream_set_underline, term_ostream_get_hyperlink_ref, term_ostream_get_hyperlink_id, term_ostream_set_hyperlink, term_ostream_create, term_styled_ostream_create, html_styled_ostream_create, handle_color_option, handle_style_option, style_file_prepare, styled_ostream_create, libtextstyle_set_failure_exit_code): Likewise. * lib/unicodeio.c (exit_failure_callback, fallback_failure_callback): Likewise. * lib/wait-process.c (cleanup_slaves_action): Likewise. * tests/signature.h (SIGNATURE_CHECK2): Likewise. * tests/test-areadlink.c (do_areadlink): Likewise. * tests/test-areadlinkat.c (do_areadlinkat): Likewise. * tests/test-ceilf-ieee.c (main): Likewise. * tests/test-ceilf1.c (main): Likewise. * tests/test-dirent.c (dir): Likewise. * tests/test-fchownat.c (main): Likewise. * tests/test-fdopendir.c (main): Likewise. * tests/test-filenamecat.c (main): Likewise. * tests/test-floor1.c (main): Likewise. * tests/test-floorf-ieee.c (main): Likewise. * tests/test-floorf1.c (main): Likewise. * tests/test-fseeko.c (main): Likewise. * tests/test-fstatat.c (main): Likewise. * tests/test-ftello.c (main): Likewise. * tests/test-getdomainname.c (main): Likewise. * tests/test-getgroups.c (main): Likewise. * tests/test-gethostname.c (main): Likewise. * tests/test-math-c++.cc (OVERLOADED_CHECK): Likewise. * tests/test-mkdirat.c (main): Likewise. * tests/test-openat.c (main): Likewise. * tests/test-parse-datetime.c (main): Likewise. * tests/test-quotearg-simple.c (main): Likewise. * tests/test-quotearg.c (main): Likewise. * tests/test-sethostname2.c (main): Likewise. * tests/test-unlinkat.c (main): Likewise. * tests/test-version-etc.c (main): Likewise. * tests/test-xalloc-die.c (main): Likewise. * tests/test-xfprintf-posix.c (main): Likewise. * tests/test-xprintf-posix.c (main): Likewise. * tests/test-xvasprintf.c (main): Likewise.
* maint: run 'make update-copyright'Paul Eggert2020-12-311-1/+1
|
* maint: Run 'make update-copyright'Paul Eggert2019-12-311-1/+1
|
* maint: Run 'make update-copyright'Paul Eggert2019-01-011-1/+1
|
* file-has-acl: Fix test failure on Cygwin 2.9.Bruno Haible2018-09-181-7/+7
| | | | | | | | | | | | | * m4/acl.m4 (gl_FUNC_ACL): Update comments regarding Cygwin. * lib/acl-internal.h: Likewise. (HAVE_ACL_EXTENDED_FILE): Undefine on Cygwin. * lib/acl-internal.c: Update comments regarding Cygwin. * lib/acl_entries.c: Likewise. * lib/file-has-acl.c: Likewise. (file_has_acl): For Cygwin, use a different way to determine whether the "default" ACL of a directory is nontrivial. * lib/get-permissions.c: Update comments regarding Cygwin. * lib/set-permissions.c: Likewise.
* Continue to use spaces for indentation, not tabs.Bruno Haible2018-06-251-127/+127
|
* maint: Run 'make update-copyright'Paul Eggert2018-01-011-1/+1
|
* all: prefer https: URLsPaul Eggert2017-09-131-1/+1
|
* version-etc: new yearPaul Eggert2017-01-011-1/+1
| | | | | | | | | | * 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'.
* acl: fix missing return on CygwinEric Blake2016-03-081-0/+1
| | | | | | | | | | | | | | | | 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>
* version-etc: new yearPaul Eggert2016-01-011-1/+1
| | | | | | | | | | * 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'.
* maint: add coding cookies to non-ASCII sourcesPaul Eggert2015-09-241-1/+1
| | | | | | | | | | | | 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.
* acl-permissions: Document FreeBSD ACL_TYPE_NFS4 aclsAndreas Gruenbacher2015-07-051-0/+9
| | | | | | * lib/set-permissions.c (set_acls): Document where support for FreeBSD ACL_TYPE_NFS4 acls should go. * lib/get-permissions.c (get_permissions): Likewise.
* acl-permissions: Fix on FreeBSDAndreas Gruenbacher2015-07-051-1/+2
| | | | | | | | | 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.
* file-has-acl, acl-permissions: fix some more HP-UX typosAndreas Gruenbacher2015-07-051-5/+5
| | | | | | 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.
* file-has-acl, acl-permissions: fix HP-UX typosPaul Eggert2015-07-041-10/+10
| | | | | | | | | 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.
* set-permissions.c: adjust acl_from_mode's cpp guardJim Meyering2015-07-031-12/+15
| | | | | | | | | * 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.
* acl: fix definition of acl_from_mode on FreeBSDPádraig Brady2015-07-011-2/+1
| | | | | | | | | | | | 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.
* * lib/set-permissions.c: Spelling fix.Paul Eggert2015-06-141-1/+1
|
* acl-permissions: more porting to AIXPaul Eggert2015-06-051-1/+1
| | | | | | | | | | * 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.
* acl-permissions: Fix build on Mac OS X and older AIX (Bug#20681)Andreas Gruenbacher2015-05-291-6/+7
| | | | | * lib/set-permissions.c (set_acls): Fix more errors introduced in the acl module rewrite.
* acl-permissions: Fix build on Solaris and CygwinAndreas Gruenbacher2015-05-291-6/+6
| | | | | | | 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.
* qacl: Reimplement qset_acl and qcopy_acl (Bug#20666)Andreas Gruenbacher2015-05-271-0/+833
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.