From 06318e7b98129050e14aef2370ac62da31176f6e Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 26 Aug 2026 06:22:13 +0900 Subject: [PATCH] tar-util: add missing dlopen libarchive Otherwise, if the library is not loaded yet, these functions will fail. Note, currently, all callers of tar_x/tar_c() load libarchive before calling them. So, this should not change any behavior. Just for safety and following our usual coding style. --- src/shared/tar-util.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/shared/tar-util.c b/src/shared/tar-util.c index 53833da105..f3b63fe98f 100644 --- a/src/shared/tar-util.c +++ b/src/shared/tar-util.c @@ -749,6 +749,10 @@ int tar_x(int input_fd, int tree_fd, TarFlags flags) { assert(input_fd >= 0); assert(tree_fd >= 0); + r = dlopen_libarchive(LOG_DEBUG); + if (r < 0) + return r; + _cleanup_(archive_read_freep) struct archive *a = NULL; a = sym_archive_read_new(); if (!a) @@ -1605,6 +1609,10 @@ int tar_c(int tree_fd, int output_fd, const char *filename, int hardlink_db_fd, assert(tree_fd >= 0); assert(output_fd >= 0); + r = dlopen_libarchive(LOG_DEBUG); + if (r < 0) + return r; + _cleanup_(archive_write_freep) struct archive *a = sym_archive_write_new(); if (!a) return log_oom();