1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-27 10:25:37 +03:00

Merge pull request #1157 from dvdhrm/logind-wallfix

login: fix NULL-deref on wall_message
This commit is contained in:
Daniel Mack 2015-09-05 14:33:56 +02:00
commit c7430c3d1a

View File

@ -1796,9 +1796,11 @@ static int update_schedule_file(Manager *m) {
if (r < 0)
return log_error_errno(r, "Failed to create shutdown subdirectory: %m");
t = cescape(m->wall_message);
if (!t)
return log_oom();
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)
@ -1814,7 +1816,7 @@ static int update_schedule_file(Manager *m) {
m->enable_wall_messages,
m->scheduled_shutdown_type);
if (!isempty(m->wall_message))
if (t)
fprintf(f, "WALL_MESSAGE=%s\n", t);
r = fflush_and_check(f);