chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
23579b0
)
logind: make scope of wall message handling smaller
author
Lennart Poettering
<lennart@poettering.net>
Sat, 5 Sep 2015 18:24:08 +0000
(20:24 +0200)
committer
Sven Eden
<yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:19:06 +0000
(10:19 +0100)
src/login/logind-dbus.c
patch
|
blob
|
history
diff --git
a/src/login/logind-dbus.c
b/src/login/logind-dbus.c
index def9f3927474a212495bee9aaf41faca053b8f91..ac987ec57aa28fc04ac7ed4c5a4c1112a49e3b94 100644
(file)
--- a/
src/login/logind-dbus.c
+++ b/
src/login/logind-dbus.c
@@
-1772,10
+1772,9
@@
static int nologin_timeout_handler(
}
static int update_schedule_file(Manager *m) {
}
static int update_schedule_file(Manager *m) {
-
- int r;
+ _cleanup_free_ char *temp_path = NULL;
_cleanup_fclose_ FILE *f = NULL;
_cleanup_fclose_ FILE *f = NULL;
-
_cleanup_free_ char *t = NULL, *temp_path = NULL
;
+
int r
;
assert(m);
assert(m);
@@
-1783,12
+1782,6
@@
static int update_schedule_file(Manager *m) {
if (r < 0)
return log_error_errno(r, "Failed to create shutdown subdirectory: %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");
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");
@@
-1803,8
+1796,17
@@
static int update_schedule_file(Manager *m) {
m->enable_wall_messages,
m->scheduled_shutdown_type);
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);
fprintf(f, "WALL_MESSAGE=%s\n", t);
+ }
r = fflush_and_check(f);
if (r < 0)
r = fflush_and_check(f);
if (r < 0)