diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-07-22 11:01:43 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-07-22 14:31:17 +0900 |
commit | 03c5f6cc02648eeff3179b2b762d46b9e1889bb1 (patch) | |
tree | 18b4b2cf184a2d9750ee2a2c7171a78f6cc98dc0 | |
parent | f677270ebb4c57c1da3b948455250b38a75b89fb (diff) | |
download | systemd-03c5f6cc02648eeff3179b2b762d46b9e1889bb1.tar.gz |
pstore: remove temporary file on failure
-rw-r--r-- | src/pstore/pstore.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/pstore/pstore.c b/src/pstore/pstore.c index 58db27fe1a..dfa95742d3 100644 --- a/src/pstore/pstore.c +++ b/src/pstore/pstore.c @@ -170,8 +170,8 @@ static int move_file(PStoreEntry *pe, const char *subdir) { } static int write_dmesg(const char *dmesg, size_t size, const char *id) { - _cleanup_(unlink_and_freep) char *ofd_path = NULL; - _cleanup_free_ char *tmp_path = NULL; + _cleanup_(unlink_and_freep) char *tmp_path = NULL; + _cleanup_free_ char *ofd_path = NULL; _cleanup_close_ int ofd = -1; ssize_t wr; int r; @@ -194,7 +194,7 @@ static int write_dmesg(const char *dmesg, size_t size, const char *id) { r = link_tmpfile(ofd, tmp_path, ofd_path); if (r < 0) return log_error_errno(r, "Failed to write temporary file %s: %m", ofd_path); - ofd_path = mfree(ofd_path); + tmp_path = mfree(tmp_path); return 0; } |