summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2023-01-13 11:03:27 +0200
committerMichal Domonkos <mdomonko@redhat.com>2023-03-13 15:32:25 +0100
commitae19700160b3c4a029cb62f96d09422c6c9758c8 (patch)
treeb4bfab180350101358a93071dc54a8df52acb7cb
parent6792666f1be55abe487648f564fb0855d4cb8c15 (diff)
downloadrpm-ae19700160b3c4a029cb62f96d09422c6c9758c8.tar.gz
Use our O_DIRECTORY equivalent when opening files for setmeta
Ie if we expect a directory, ensure we got one. (cherry picked from commit ccfca4146d3c0c7ac3a3be37b3ea501620954d2f)
-rw-r--r--lib/fsm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/fsm.c b/lib/fsm.c
index d78c8eafd..b2e5fe525 100644
--- a/lib/fsm.c
+++ b/lib/fsm.c
@@ -1022,7 +1022,8 @@ setmeta:
/* Only follow safe symlinks, and never on temporary files */
if (fp->suffix)
flags |= AT_SYMLINK_NOFOLLOW;
- fd = fsmOpenat(di.dirfd, fp->fpath, flags, 0);
+ fd = fsmOpenat(di.dirfd, fp->fpath, flags,
+ S_ISDIR(fp->sb.st_mode));
if (fd < 0)
rc = RPMERR_OPEN_FAILED;
}