From 640daee2954fb456b970be48ba8adc39eed9b21d Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Tue, 21 Nov 2023 22:40:20 +0100 Subject: [PATCH] libdpkg: Use an intermediate mode variable in secure_unlink_statted() --- lib/dpkg/path-remove.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/dpkg/path-remove.c b/lib/dpkg/path-remove.c index 6afb37607..e4d6ebe01 100644 --- a/lib/dpkg/path-remove.c +++ b/lib/dpkg/path-remove.c @@ -37,9 +37,11 @@ int secure_unlink_statted(const char *pathname, const struct stat *stab) { - if (S_ISREG(stab->st_mode) ? (stab->st_mode & 07000) : - !(S_ISLNK(stab->st_mode) || S_ISDIR(stab->st_mode) || - S_ISFIFO(stab->st_mode) || S_ISSOCK(stab->st_mode))) { + mode_t mode = stab->st_mode; + + if (S_ISREG(mode) ? (mode & 07000) : + !(S_ISLNK(mode) || S_ISDIR(mode) || + S_ISFIFO(mode) || S_ISSOCK(mode))) { if (chmod(pathname, 0600)) return -1; } -- 2.11.4.GIT