]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: Write temporary LUKS header to /var/tmp instead of /tmp 25410/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 17 Nov 2022 13:15:28 +0000 (14:15 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 17 Nov 2022 13:15:28 +0000 (14:15 +0100)
This is a relatively large file so let's not create it in memory.

src/partition/repart.c

index 9ab051190ddc28b841ac3e346dc86c40868b3773..07efcd2857b8c6f3c68f956e0e9cb48195599e41 100644 (file)
@@ -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");