diff options
author | Lennart Poettering <lennart@poettering.net> | 2022-11-24 14:59:25 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2022-12-15 17:54:27 +0100 |
commit | 557bde331b1df20e0bb0c7fc208db6653288b26e (patch) | |
tree | 4d36b3c99722b246cc0302980a395e83fda9cb98 /src/systemctl | |
parent | 1ae886fe28cb6f3c6a80bde4cf2a26435100a59d (diff) | |
download | systemd-557bde331b1df20e0bb0c7fc208db6653288b26e.tar.gz |
systemctl: don't unlink non-existing temporary files
Diffstat (limited to 'src/systemctl')
-rw-r--r-- | src/systemctl/systemctl-edit.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c index 233ca35d51..3d519ccb8d 100644 --- a/src/systemctl/systemctl-edit.c +++ b/src/systemctl/systemctl-edit.c @@ -626,6 +626,7 @@ int verb_edit(int argc, char *argv[], void *userdata) { goto end; } + f->tmp = mfree(f->tmp); log_info("Successfully installed edited file '%s'.", f->path); } @@ -638,8 +639,10 @@ int verb_edit(int argc, char *argv[], void *userdata) { } end: - for (EditFile *f = edit_files; f && f->path; f++) { - (void) unlink(f->tmp); + for (EditFile *f = ASSERT_PTR(edit_files); f->path; f++) { + + if (f->tmp) + (void) unlink(f->tmp); /* Removing empty dropin dirs */ if (!arg_full) { |