From 0b75744d5c20ffab525990fefc458c58ca966fe3 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Thu, 17 Nov 2022 14:15:28 +0100 Subject: [PATCH] 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. --- src/partition/repart.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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"); -- 2.47.3