]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
edit-util: unlink temporary file on failure 26756/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 11 Mar 2023 13:20:51 +0000 (22:20 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 11 Mar 2023 13:20:54 +0000 (22:20 +0900)
Addresses the suggestion
https://github.com/systemd/systemd/pull/26756#discussion_r1133078705.

src/shared/edit-util.c

index 207732e3207460009e239e66519af51d554712bf..ba1f4128a0d771cc05d3ab53f42848516b65ae52 100644 (file)
@@ -106,7 +106,7 @@ int edit_files_add(
 }
 
 static int create_edit_temp_file(EditFile *e) {
-        _cleanup_free_ char *temp = NULL;
+        _cleanup_(unlink_and_freep) char *temp = NULL;
         unsigned line = 1;
         int r;