]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: don't unlink non-existing temporary files 25487/head
authorLennart Poettering <lennart@poettering.net>
Thu, 24 Nov 2022 13:59:25 +0000 (14:59 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 15 Dec 2022 16:54:27 +0000 (17:54 +0100)
src/systemctl/systemctl-edit.c

index 233ca35d51e5acb1d9c2d265df3c750092912d21..3d519ccb8d3d1d84450d0fc76ffda9d991979864 100644 (file)
@@ -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) {