From: Lennart Poettering Date: Thu, 24 Nov 2022 13:59:25 +0000 (+0100) Subject: systemctl: don't unlink non-existing temporary files X-Git-Tag: v253-rc1~257^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F25487%2Fhead;p=thirdparty%2Fsystemd.git systemctl: don't unlink non-existing temporary files --- diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c index 233ca35d51e..3d519ccb8d3 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) {