This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=640daee2954fb456b970be48ba8adc39eed9b21d

commit 640daee2954fb456b970be48ba8adc39eed9b21d
Author: Guillem Jover <[email protected]>
AuthorDate: Tue Nov 21 22:40:20 2023 +0100

    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;
        }

-- 
Dpkg.Org's dpkg

Reply via email to