mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-09-11 04:37:21 -04:00
syscall: silence scan-build dead-store in do_fchmodat_nofollow fallback
When neither AT_FDCWD nor AT_SYMLINK_NOFOLLOW is available, the function body is a no-op warning that never reads mode or dfd, so the leading 'mode &= CHMOD_BITS' became a dead store and dfd an unused parameter -- which the pinned clang-18 scan-build gate flags (deadcode.DeadStores). Move the mask inside the AT_SYMLINK_NOFOLLOW guard where mode is actually used, and mark dfd/mode used in the fallback. No behavior change on any platform that has the symlink-safe primitive.
This commit is contained in:
1 parent
7aea9d5f8e
commit
7b16872eff
1 file changed
+3
-1
@@ -1485,8 +1485,8 @@ int do_chmod(const char *path, mode_t mode)
|
||||
* exists we skip with a warning rather than follow the leaf. */
|
||||
static int do_fchmodat_nofollow(int dfd, const char *name, mode_t mode)
|
||||
{
|
||||
mode &= CHMOD_BITS;
|
||||
#if defined AT_FDCWD && defined AT_SYMLINK_NOFOLLOW
|
||||
mode &= CHMOD_BITS;
|
||||
# if defined __linux__
|
||||
{
|
||||
STRUCT_STAT st;
|
||||
@@ -1532,6 +1532,8 @@ static int do_fchmodat_nofollow(int dfd, const char *name, mode_t mode)
|
||||
return fchmodat(dfd, name, mode, AT_SYMLINK_NOFOLLOW);
|
||||
# endif
|
||||
#else
|
||||
(void)dfd;
|
||||
(void)mode;
|
||||
/* No symlink-safe chmod primitive here: skip rather than follow the leaf. */
|
||||
rprintf(FWARNING, "do_chmod: no symlink-safe chmod for \"%s\"; mode not set\n", name);
|
||||
return 1;
|
||||
|
||||
Reference in new issue
Block a user