From: Michael Tremer Date: Mon, 18 Jul 2022 08:52:12 +0000 (+0000) Subject: Move all temporary files directly into /var/tmp X-Git-Tag: 0.9.28~685 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6bf2cf5081d71724482d2c5d489540f27d585075;p=pakfire.git Move all temporary files directly into /var/tmp When running Pakfire as an unprivileged user, we cannot create temporary files in a subdirectory which has been created earlier by a different user. Hence we now put everything directly into /var/tmp where everyone should have write permissions all of the time. Signed-off-by: Michael Tremer --- diff --git a/configure.ac b/configure.ac index 8bd128c31..e71fa4c6f 100644 --- a/configure.ac +++ b/configure.ac @@ -274,7 +274,7 @@ AC_DEFINE_UNQUOTED([PAKFIRE_PRIVATE_DIR], ["/var/lib/${PACKAGE_NAME}"], [The path where Pakfire stores its private data]) AC_DEFINE_UNQUOTED([PAKFIRE_SCRIPTS_DIR], ["${PREFIX}/lib/${PACKAGE_NAME}"], [The path where Pakfire stores its scripts]) -AC_DEFINE_UNQUOTED([PAKFIRE_TMP_DIR], ["/var/tmp/${PACKAGE_NAME}"], +AC_DEFINE_UNQUOTED([PAKFIRE_TMP_DIR], ["/var/tmp"], [The path where Pakfire stores temporary data]) AC_CONFIG_FILES([ diff --git a/src/libpakfire/packager.c b/src/libpakfire/packager.c index 02434f59e..1581984b5 100644 --- a/src/libpakfire/packager.c +++ b/src/libpakfire/packager.c @@ -68,7 +68,7 @@ struct pakfire_packager { static int pakfire_packager_create_mtree(struct pakfire* pakfire, struct archive** mtree, FILE** f, const char** fields) { - char path[] = PAKFIRE_TMP_DIR "/.pakfire-mtree.XXXXXX"; + char path[] = PAKFIRE_TMP_DIR "/pakfire-mtree.XXXXXX"; int r; // Create an mtree @@ -136,7 +136,7 @@ ERROR: } static int pakfire_packager_create_payload(struct pakfire_packager* p) { - char path[] = PAKFIRE_TMP_DIR "/.pakfire-payload.XXXXXX"; + char path[] = PAKFIRE_TMP_DIR "/pakfire-payload.XXXXXX"; // Do not compress source packages const int compress = !pakfire_package_is_source(p->pkg); diff --git a/src/libpakfire/pakfire.c b/src/libpakfire/pakfire.c index a0facdbae..4dffb7328 100644 --- a/src/libpakfire/pakfire.c +++ b/src/libpakfire/pakfire.c @@ -597,7 +597,7 @@ ERROR: PAKFIRE_EXPORT int pakfire_create(struct pakfire** pakfire, const char* path, const char* arch, const char* conf, int flags, int loglevel, pakfire_log_callback log_callback, void* log_data) { - char tempdir[PATH_MAX] = PAKFIRE_TMP_DIR "/XXXXXX"; + char tempdir[PATH_MAX] = PAKFIRE_TMP_DIR "/pakfire-root-XXXXXX"; int r = 1; // Reset pakfire pointer diff --git a/src/libpakfire/repo.c b/src/libpakfire/repo.c index ba77be770..822de8bc3 100644 --- a/src/libpakfire/repo.c +++ b/src/libpakfire/repo.c @@ -128,7 +128,7 @@ static int pakfire_repo_import_key(struct pakfire_repo* repo, const char* url) { const char* name = pakfire_repo_get_name(repo); DEBUG(repo->pakfire, "Importing key for repository %s from %s...\n", name, url); - char path[PATH_MAX] = PAKFIRE_TMP_DIR "/XXXXXX"; + char path[PATH_MAX] = PAKFIRE_TMP_DIR "/pakfire-key.XXXXXX"; struct pakfire_key** keys = NULL; // Allocate a temporary file name diff --git a/src/libpakfire/request.c b/src/libpakfire/request.c index 57576b7b3..2cdbb342c 100644 --- a/src/libpakfire/request.c +++ b/src/libpakfire/request.c @@ -455,7 +455,7 @@ ERROR: static int pakfire_request_add_url(struct pakfire_request* request, int action, const char* url, int extra_flags) { struct pakfire_downloader* downloader; - char path[PATH_MAX] = PAKFIRE_TMP_DIR "/XXXXXX"; + char path[PATH_MAX] = PAKFIRE_TMP_DIR "/pakfire-download.XXXXXX"; // Allocate a temporary file name FILE* f = pakfire_mktemp(path);