From: Daan De Meyer Date: Thu, 17 Nov 2022 13:15:28 +0000 (+0100) Subject: repart: Write temporary LUKS header to /var/tmp instead of /tmp X-Git-Tag: v253-rc1~498^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F25410%2Fhead;p=thirdparty%2Fsystemd.git repart: Write temporary LUKS header to /var/tmp instead of /tmp This is a relatively large file so let's not create it in memory. --- diff --git a/src/partition/repart.c b/src/partition/repart.c index 9ab051190dd..07efcd2857b 100644 --- a/src/partition/repart.c +++ b/src/partition/repart.c @@ -3178,6 +3178,7 @@ static int partition_encrypt(Context *context, Partition *p, const char *node) { const char *passphrase = NULL; size_t passphrase_size = 0; sd_id128_t uuid; + const char *vt; int r; assert(context); @@ -3194,7 +3195,11 @@ static int partition_encrypt(Context *context, Partition *p, const char *node) { log_info("Encrypting future partition %" PRIu64 "...", p->partno); - r = fopen_temporary_child(NULL, &h, &hp); + r = var_tmp_dir(&vt); + if (r < 0) + return log_error_errno(r, "Failed to determine temporary files directory: %m"); + + r = fopen_temporary_child(vt, &h, &hp); if (r < 0) return log_error_errno(r, "Failed to create temporary LUKS header file: %m");