]> Savannah Git Hosting - gnulib.git/commitdiff
acl: First step towards more consistent function names.
authorBruno Haible <bruno@clisp.org>
Sat, 24 Aug 2024 15:58:48 +0000 (17:58 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 24 Aug 2024 16:20:47 +0000 (18:20 +0200)
* lib/acl.h (xset_acl): New declaration.
(set_acl): Mark deprecated.
(xcopy_acl): New declaration.
(copy_acl): Mark deprecated.
* lib/set-acl.c (xset_acl): Renamed from set_acl.
(set_acl): New function.
* lib/copy-acl.c (xcopy_acl): Renamed from copy_acl.
(copy_acl): New function.
* tests/test-set-mode-acl.c (main): Test xset_acl instead of set_acl.
* tests/test-copy-acl.c (main): Test xcopy_acl instead of copy_acl.

ChangeLog
lib/acl.h
lib/copy-acl.c
lib/set-acl.c
tests/test-copy-acl.c
tests/test-set-mode-acl.c

index 29c02f547810ad010585400953cdcd14833e73b1..b223243229cccd2f010935570d06d9ace52f4d9f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2024-08-24  Bruno Haible  <bruno@clisp.org>
+
+       acl: First step towards more consistent function names.
+       * lib/acl.h (xset_acl): New declaration.
+       (set_acl): Mark deprecated.
+       (xcopy_acl): New declaration.
+       (copy_acl): Mark deprecated.
+       * lib/set-acl.c (xset_acl): Renamed from set_acl.
+       (set_acl): New function.
+       * lib/copy-acl.c (xcopy_acl): Renamed from copy_acl.
+       (copy_acl): New function.
+       * tests/test-set-mode-acl.c (main): Test xset_acl instead of set_acl.
+       * tests/test-copy-acl.c (main): Test xcopy_acl instead of copy_acl.
+
 2024-08-24  Paul Eggert  <eggert@cs.ucla.edu>
 
        diffseq: port to clang 18.1.6 in ‘patch’
index 0bf78a654d25d1d70e38bdad426b2ca3e3080cb2..475231c2db7e3e5165af9412fa86f0e109cf5f8f 100644 (file)
--- a/lib/acl.h
+++ b/lib/acl.h
@@ -20,7 +20,7 @@
 #ifndef _GL_ACL_H
 #define _GL_ACL_H 1
 
-/* This file uses _GL_ATTRIBUTE_CONST.  */
+/* This file uses _GL_ATTRIBUTE_CONST, _GL_ATTRIBUTE_DEPRECATED.  */
 #if !_GL_CONFIG_H_INCLUDED
  #error "Please include config.h first."
 #endif
@@ -35,10 +35,18 @@ extern "C" {
 
 bool acl_errno_valid (int) _GL_ATTRIBUTE_CONST;
 int file_has_acl (char const *, struct stat const *);
+
 int qset_acl (char const *, int, mode_t);
-int set_acl (char const *, int, mode_t);
+int xset_acl (char const *, int, mode_t);
+/* Old name of xset_acl.  */
+_GL_ATTRIBUTE_DEPRECATED int set_acl (char const *, int, mode_t);
+
 int qcopy_acl (char const *, int, char const *, int, mode_t);
-int copy_acl (char const *, int, char const *, int, mode_t);
+int xcopy_acl (char const *, int, char const *, int, mode_t);
+/* Old name of xcopy_acl.  */
+_GL_ATTRIBUTE_DEPRECATED int copy_acl (char const *, int, char const *, int,
+                                       mode_t);
+
 int chmod_or_fchmod (char const *, int, mode_t);
 
 
index bde98f0b2695a11575900e289ed5a6819ab588b1..b4aa920ed5feaebfae9006fba7d558b9cea6dc46 100644 (file)
@@ -40,8 +40,8 @@
    negative error code.  */
 
 int
-copy_acl (const char *src_name, int source_desc, const char *dst_name,
-          int dest_desc, mode_t mode)
+xcopy_acl (const char *src_name, int source_desc, const char *dst_name,
+           int dest_desc, mode_t mode)
 {
   int ret = qcopy_acl (src_name, source_desc, dst_name, dest_desc, mode);
   switch (ret)
@@ -59,3 +59,10 @@ copy_acl (const char *src_name, int source_desc, const char *dst_name,
     }
   return ret;
 }
+
+int
+copy_acl (const char *src_name, int source_desc, const char *dst_name,
+          int dest_desc, mode_t mode)
+{
+  return xcopy_acl (src_name, source_desc, dst_name, dest_desc, mode);
+}
index dd3b596805c74278817f638797498af9f78c505d..08ce8b80db4bd087e236176b821793d788e3df71 100644 (file)
     return -1.  */
 
 int
-set_acl (char const *name, int desc, mode_t mode)
+xset_acl (char const *name, int desc, mode_t mode)
 {
   int ret = qset_acl (name, desc, mode);
   if (ret != 0)
     error (0, errno, _("setting permissions for %s"), quote (name));
   return ret;
 }
+
+int
+set_acl (char const *name, int desc, mode_t mode)
+{
+  return xset_acl (name, desc, mode);
+}
index 4ca92108900e0aa11b0054a999c7669c49b0b6d7..9970ea4ce1ed9c0e11d3ef0339f3c24cc7cb2997 100644 (file)
@@ -60,7 +60,7 @@ main (int argc, char *argv[])
     }
 
 #if USE_ACL
-  if (copy_acl (file1, fd1, file2, fd2, mode))
+  if (xcopy_acl (file1, fd1, file2, fd2, mode))
     exit (EXIT_FAILURE);
 #else
   chmod (file2, mode);
index 1c2217df57bcddcbf0db4bf818bf490aab66bdd1..8dcde9254fb3d0479f285aec4d32e9f04c5b6b6c 100644 (file)
@@ -35,7 +35,7 @@ main (int argc, char *argv[])
   file = argv[1];
   mode = strtol (argv[2], NULL, 8);
 
-  set_acl (file, -1, mode);
+  xset_acl (file, -1, mode);
 
   return test_exit_status;
 }