summaryrefslogtreecommitdiff
path: root/src/login/logind-seat.c
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/login/logind-seat.c
parenta90d9ee1620ce65ecf07224f2d2d16f9f5c48ca9 (diff)
downloadsystemd-70f1280c83ce4cc9f11fa99f1386cdf621e70ee4.tar.gz
tree-wide: use unlink_and_freep() moreover
Diffstat (limited to 'src/login/logind-seat.c')
-rw-r--r--src/login/logind-seat.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c
index 65323f6c92..c92e59ae51 100644
--- a/src/login/logind-seat.c
+++ b/src/login/logind-seat.c
@@ -13,6 +13,7 @@
#include "fd-util.h"
#include "fileio.h"
#include "format-util.h"
+#include "fs-util.h"
#include "logind-seat-dbus.h"
#include "logind-seat.h"
#include "logind-session-dbus.h"
@@ -81,7 +82,7 @@ Seat* seat_free(Seat *s) {
}
int seat_save(Seat *s) {
- _cleanup_free_ char *temp_path = NULL;
+ _cleanup_(unlink_and_freep) char *temp_path = NULL;
_cleanup_fclose_ FILE *f = NULL;
int r;
@@ -146,14 +147,11 @@ int seat_save(Seat *s) {
goto fail;
}
+ temp_path = mfree(temp_path);
return 0;
fail:
(void) unlink(s->state_file);
-
- if (temp_path)
- (void) unlink(temp_path);
-
return log_error_errno(r, "Failed to save seat data %s: %m", s->state_file);
}