]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
acls: correct type/size for orig_umask
authorCarlo Marcelo Arenas Belón <carenas@gmail.com>
Sun, 19 May 2024 00:44:22 +0000 (17:44 -0700)
committerAndrew Tridgell <andrew@tridgell.net>
Wed, 13 Nov 2024 20:15:14 +0000 (07:15 +1100)
Since 05278935 (- Call mkdir_defmode() instead of do_mkdir(). - Define
orig_umask in this file, not options.c. - Made orig_umask a mode_t, not an
int., 2006-02-24), the type for the global was changed, and therefore on
systems where sizeof(mode_t) != sizeof(int), writes or reads to them will
overflow to adjacent bytes.

Change the type to the one used everywhere else and avoid this problem.

While at it, silence again a warning that is being triggered by
Apple's clang 15.

acls.c

diff --git a/acls.c b/acls.c
index a2b0ff3ec683aa29de5fbad96f83eb2e2d9fd7c8..bd119e8ee6b1c1dd9b0c6f77bec47fafc05fc6ec 100644 (file)
--- a/acls.c
+++ b/acls.c
@@ -28,7 +28,7 @@ extern int dry_run;
 extern int am_root;
 extern int read_only;
 extern int list_only;
-extern int orig_umask;
+extern mode_t orig_umask;
 extern int numeric_ids;
 extern int inc_recurse;
 extern int preserve_devices;
@@ -982,7 +982,7 @@ static int set_rsync_acl(const char *fname, acl_duo *duo_item,
                 && !pack_smb_acl(&duo_item->sacl, &duo_item->racl))
                        return -1;
 #ifdef HAVE_OSX_ACLS
-               mode = 0; /* eliminate compiler warning */
+               (void)mode; /* eliminate compiler warning */
 #else
                if (type == SMB_ACL_TYPE_ACCESS) {
                        cur_mode = change_sacl_perms(duo_item->sacl, &duo_item->racl, cur_mode, mode);