]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tpm2-setup: add missing O_CLOEXEC at two places
authorLennart Poettering <lennart@poettering.net>
Wed, 26 Feb 2025 08:10:16 +0000 (09:10 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 4 Mar 2025 14:45:13 +0000 (15:45 +0100)
(cherry picked from commit f4e5a730002fa7ed714b89775c3e5fae6d003aae)

src/tpm2-setup/tpm2-setup.c

index ee9d243d5ee49ce236f7f3d4da386944e5121be1..424ab9ac32db09b0a0c7f7908fb57dc8380c48aa 100644 (file)
@@ -338,7 +338,7 @@ static int run(int argc, char *argv[]) {
         /* Write out public key (note that we only do that as a help to the user, we don't make use of this ever */
         _cleanup_(unlink_and_freep) char *t = NULL;
         _cleanup_fclose_ FILE *f = NULL;
-        r = fopen_tmpfile_linkable(pem_path, O_WRONLY, &t, &f);
+        r = fopen_tmpfile_linkable(pem_path, O_WRONLY|O_CLOEXEC, &t, &f);
         if (r < 0)
                 return log_error_errno(r, "Failed to open SRK public key file '%s' for writing: %m", pem_path);
 
@@ -365,7 +365,7 @@ static int run(int argc, char *argv[]) {
         (void) mkdir_parents(tpm2b_public_path, 0755);
 
         /* Now also write this out in TPM2B_PUBLIC format */
-        r = fopen_tmpfile_linkable(tpm2b_public_path, O_WRONLY, &t, &f);
+        r = fopen_tmpfile_linkable(tpm2b_public_path, O_WRONLY|O_CLOEXEC, &t, &f);
         if (r < 0)
                 return log_error_errno(r, "Failed to open SRK public key file '%s' for writing: %m", tpm2b_public_path);