diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-02-22 23:13:31 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-02-23 10:10:48 +0900 |
commit | 70f1280c83ce4cc9f11fa99f1386cdf621e70ee4 (patch) | |
tree | 327acb1e20c39d4e7daa3daaf11fe34d4efb42b5 /src/machine | |
parent | a90d9ee1620ce65ecf07224f2d2d16f9f5c48ca9 (diff) | |
download | systemd-70f1280c83ce4cc9f11fa99f1386cdf621e70ee4.tar.gz |
tree-wide: use unlink_and_freep() moreover
Diffstat (limited to 'src/machine')
-rw-r--r-- | src/machine/machine.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/machine/machine.c b/src/machine/machine.c index c08a645814..acb86c1a83 100644 --- a/src/machine/machine.c +++ b/src/machine/machine.c @@ -17,6 +17,7 @@ #include "fd-util.h" #include "fileio.h" #include "format-util.h" +#include "fs-util.h" #include "hashmap.h" #include "machine-dbus.h" #include "machine.h" @@ -107,7 +108,7 @@ Machine* machine_free(Machine *m) { } int machine_save(Machine *m) { - _cleanup_free_ char *temp_path = NULL; + _cleanup_(unlink_and_freep) char *temp_path = NULL; _cleanup_fclose_ FILE *f = NULL; int r; @@ -211,6 +212,8 @@ int machine_save(Machine *m) { goto fail; } + temp_path = mfree(temp_path); + if (m->unit) { char *sl; @@ -226,9 +229,6 @@ int machine_save(Machine *m) { fail: (void) unlink(m->state_file); - if (temp_path) - (void) unlink(temp_path); - return log_error_errno(r, "Failed to save machine data %s: %m", m->state_file); } |