summaryrefslogtreecommitdiff
path: root/src/journal-remote
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-02-22 23:13:31 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-02-23 10:10:48 +0900
commit70f1280c83ce4cc9f11fa99f1386cdf621e70ee4 (patch)
tree327acb1e20c39d4e7daa3daaf11fe34d4efb42b5 /src/journal-remote
parenta90d9ee1620ce65ecf07224f2d2d16f9f5c48ca9 (diff)
downloadsystemd-70f1280c83ce4cc9f11fa99f1386cdf621e70ee4.tar.gz
tree-wide: use unlink_and_freep() moreover
Diffstat (limited to 'src/journal-remote')
-rw-r--r--src/journal-remote/journal-upload.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c
index 5a34b73f76..fc55f13bab 100644
--- a/src/journal-remote/journal-upload.c
+++ b/src/journal-remote/journal-upload.c
@@ -18,6 +18,7 @@
#include "fd-util.h"
#include "fileio.h"
#include "format-util.h"
+#include "fs-util.h"
#include "glob-util.h"
#include "journal-upload.h"
#include "log.h"
@@ -116,7 +117,7 @@ static int check_cursor_updating(Uploader *u) {
}
static int update_cursor_state(Uploader *u) {
- _cleanup_free_ char *temp_path = NULL;
+ _cleanup_(unlink_and_freep) char *temp_path = NULL;
_cleanup_fclose_ FILE *f = NULL;
int r;
@@ -141,12 +142,10 @@ static int update_cursor_state(Uploader *u) {
goto fail;
}
+ temp_path = mfree(temp_path);
return 0;
fail:
- if (temp_path)
- (void) unlink(temp_path);
-
(void) unlink(u->state_file);
return log_error_errno(r, "Failed to save state %s: %m", u->state_file);