diff options
author | Tom Gundersen <teg@jklm.no> | 2015-09-07 02:59:08 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2015-09-07 02:59:08 +0200 |
commit | 6167a91c745e5406164ef57e27212ba572d9a0dc (patch) | |
tree | 35af349cc76d850d1593163d8dabfd4c59dfe267 /src/login | |
parent | 2009bcfd23400bacd50848ac3e72cd5f6fbe53db (diff) | |
parent | 08acb521f30d692f13056daa23fb1323528249ff (diff) |
Merge pull request #1165 from poettering/nspawn-files
various fixes to the core, logind, machined, nspawn
Diffstat (limited to 'src/login')
-rw-r--r-- | src/login/logind-dbus.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 14b6e0ddad..b6fa50aa52 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -1789,10 +1789,9 @@ static int nologin_timeout_handler( } static int update_schedule_file(Manager *m) { - - int r; + _cleanup_free_ char *temp_path = NULL; _cleanup_fclose_ FILE *f = NULL; - _cleanup_free_ char *t = NULL, *temp_path = NULL; + int r; assert(m); @@ -1800,12 +1799,6 @@ static int update_schedule_file(Manager *m) { if (r < 0) return log_error_errno(r, "Failed to create shutdown subdirectory: %m"); - if (!isempty(m->wall_message)) { - t = cescape(m->wall_message); - if (!t) - return log_oom(); - } - r = fopen_temporary("/run/systemd/shutdown/scheduled", &f, &temp_path); if (r < 0) return log_error_errno(r, "Failed to save information about scheduled shutdowns: %m"); @@ -1820,8 +1813,17 @@ static int update_schedule_file(Manager *m) { m->enable_wall_messages, m->scheduled_shutdown_type); - if (t) + if (!isempty(m->wall_message)) { + _cleanup_free_ char *t; + + t = cescape(m->wall_message); + if (!t) { + r = -ENOMEM; + goto fail; + } + fprintf(f, "WALL_MESSAGE=%s\n", t); + } r = fflush_and_check(f); if (r < 0) |