diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2023-01-13 11:03:27 +0200 |
---|---|---|
committer | Michal Domonkos <mdomonko@redhat.com> | 2023-03-13 15:32:25 +0100 |
commit | ae19700160b3c4a029cb62f96d09422c6c9758c8 (patch) | |
tree | b4bfab180350101358a93071dc54a8df52acb7cb | |
parent | 6792666f1be55abe487648f564fb0855d4cb8c15 (diff) | |
download | rpm-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.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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; } |