diff options
author | Timo Teräs <timo.teras@iki.fi> | 2022-08-15 20:47:04 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2022-08-17 21:13:40 +0300 |
commit | c21f61ddd8d742e4de2202aa623b0c06573f567b (patch) | |
tree | 5f16a15a058b3bd1896ac229704bc872ecf0e323 /src/fs_fsys.c | |
parent | 1ababaa99dd6419116224042e84276855ea23197 (diff) | |
download | apk-tools-c21f61ddd8d742e4de2202aa623b0c06573f567b.tar.gz apk-tools-c21f61ddd8d742e4de2202aa623b0c06573f567b.tar.bz2 apk-tools-c21f61ddd8d742e4de2202aa623b0c06573f567b.tar.xz apk-tools-c21f61ddd8d742e4de2202aa623b0c06573f567b.zip |
db: fix change detection for symlinks
apk_fileinfo_get() special cases symlink digest calculation.
Convert apk_fsdir_ops.file_digest to .file_info to fix symlink
change detection.
fixes #10853
Diffstat (limited to 'src/fs_fsys.c')
-rw-r--r-- | src/fs_fsys.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/fs_fsys.c b/src/fs_fsys.c index b3ec1d5..c11ca50 100644 --- a/src/fs_fsys.c +++ b/src/fs_fsys.c @@ -12,6 +12,7 @@ #include "apk_fs.h" #include "apk_xattr.h" +#include "apk_database.h" // for db->atoms #define TMPNAME_MAX (PATH_MAX + 64) @@ -265,23 +266,16 @@ static int fsys_file_control(struct apk_fsdir *d, apk_blob_t filename, int ctrl) return rc; } -static int fsys_file_digest(struct apk_fsdir *d, apk_blob_t filename, uint8_t alg, struct apk_digest *dgst) +static int fsys_file_info(struct apk_fsdir *d, apk_blob_t filename, + unsigned int flags, struct apk_file_info *fi) { struct apk_ctx *ac = d->ac; - struct apk_istream *is; - apk_blob_t blob; - int n; + int n, r; n = apk_pathbuilder_pushb(&d->pb, filename); - is = apk_istream_from_file(apk_ctx_fd_dest(ac), apk_pathbuilder_cstr(&d->pb)); + r = apk_fileinfo_get(apk_ctx_fd_dest(ac), apk_pathbuilder_cstr(&d->pb), flags, fi, &ac->db->atoms); apk_pathbuilder_pop(&d->pb, n); - if (IS_ERR(is)) return PTR_ERR(is); - - apk_digest_ctx_reset(&ac->dctx, alg); - while (apk_istream_get_all(is, &blob) == 0) - apk_digest_ctx_update(&ac->dctx, blob.ptr, blob.len); - apk_digest_ctx_final(&ac->dctx, dgst); - return apk_istream_close(is); + return r; } static const struct apk_fsdir_ops fsdir_ops_fsys = { @@ -292,7 +286,7 @@ static const struct apk_fsdir_ops fsdir_ops_fsys = { .dir_update_perms = fsys_dir_update_perms, .file_extract = fsys_file_extract, .file_control = fsys_file_control, - .file_digest = fsys_file_digest, + .file_info = fsys_file_info, }; static const struct apk_fsdir_ops *apk_fsops_get(apk_blob_t dir) |