summaryrefslogtreecommitdiff
path: root/src/login/logind-dbus.c
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2015-07-29 20:43:54 +0200
committerDaniel Mack <github@zonque.org>2015-07-29 20:43:54 +0200
commit65c85ef5118d88bc0d3459b6e8854bf1846190b9 (patch)
tree3c60aceafd3cbf6fe12eb6db934350950f4425cd /src/login/logind-dbus.c
parent1051d049a8a5811135d83a89a430c5be846866ca (diff)
parentdacd6cee76a08331b8c8616c5f30f70ee49aa2f9 (diff)
Merge pull request #779 from poettering/fflush-and-check
tree-wide: port everything over to fflush_and_check()
Diffstat (limited to 'src/login/logind-dbus.c')
-rw-r--r--src/login/logind-dbus.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index e6371ff04d..397952e7e5 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -1816,17 +1816,22 @@ static int update_schedule_file(Manager *m) {
if (!isempty(m->wall_message))
fprintf(f, "WALL_MESSAGE=%s\n", t);
- (void) fflush_and_check(f);
+ r = fflush_and_check(f);
+ if (r < 0)
+ goto fail;
- if (ferror(f) || rename(temp_path, "/run/systemd/shutdown/scheduled") < 0) {
- log_error_errno(errno, "Failed to write information about scheduled shutdowns: %m");
+ if (rename(temp_path, "/run/systemd/shutdown/scheduled") < 0) {
r = -errno;
-
- (void) unlink(temp_path);
- (void) unlink("/run/systemd/shutdown/scheduled");
+ goto fail;
}
- return r;
+ return 0;
+
+fail:
+ (void) unlink(temp_path);
+ (void) unlink("/run/systemd/shutdown/scheduled");
+
+ return log_error_errno(r, "Failed to write information about scheduled shutdowns: %m");
}
static int manager_scheduled_shutdown_handler(