summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
Diffstat (limited to 'src/login')
-rw-r--r--src/login/logind-button.c14
-rw-r--r--src/login/logind-dbus.c17
-rw-r--r--src/login/logind-seat.c8
-rw-r--r--src/login/logind-session.c15
4 files changed, 22 insertions, 32 deletions
diff --git a/src/login/logind-button.c b/src/login/logind-button.c
index 90fb93bba..d739af8ea 100644
--- a/src/login/logind-button.c
+++ b/src/login/logind-button.c
@@ -155,7 +155,7 @@ static int button_dispatch(sd_event_source *s, int fd, uint32_t revents, void *u
case KEY_POWER2:
log_struct(LOG_INFO,
LOG_MESSAGE("Power key pressed."),
- LOG_MESSAGE_ID(SD_MESSAGE_POWER_KEY),
+ "MESSAGE_ID=" SD_MESSAGE_POWER_KEY_STR,
NULL);
manager_handle_action(b->manager, INHIBIT_HANDLE_POWER_KEY, b->manager->handle_power_key, b->manager->power_key_ignore_inhibited, true);
@@ -170,7 +170,7 @@ static int button_dispatch(sd_event_source *s, int fd, uint32_t revents, void *u
case KEY_SLEEP:
log_struct(LOG_INFO,
LOG_MESSAGE("Suspend key pressed."),
- LOG_MESSAGE_ID(SD_MESSAGE_SUSPEND_KEY),
+ "MESSAGE_ID=" SD_MESSAGE_SUSPEND_KEY_STR,
NULL);
manager_handle_action(b->manager, INHIBIT_HANDLE_SUSPEND_KEY, b->manager->handle_suspend_key, b->manager->suspend_key_ignore_inhibited, true);
@@ -179,7 +179,7 @@ static int button_dispatch(sd_event_source *s, int fd, uint32_t revents, void *u
case KEY_SUSPEND:
log_struct(LOG_INFO,
LOG_MESSAGE("Hibernate key pressed."),
- LOG_MESSAGE_ID(SD_MESSAGE_HIBERNATE_KEY),
+ "MESSAGE_ID=" SD_MESSAGE_HIBERNATE_KEY_STR,
NULL);
manager_handle_action(b->manager, INHIBIT_HANDLE_HIBERNATE_KEY, b->manager->handle_hibernate_key, b->manager->hibernate_key_ignore_inhibited, true);
@@ -191,7 +191,7 @@ static int button_dispatch(sd_event_source *s, int fd, uint32_t revents, void *u
if (ev.code == SW_LID) {
log_struct(LOG_INFO,
LOG_MESSAGE("Lid closed."),
- LOG_MESSAGE_ID(SD_MESSAGE_LID_CLOSED),
+ "MESSAGE_ID=" SD_MESSAGE_LID_CLOSED_STR,
NULL);
b->lid_closed = true;
@@ -201,7 +201,7 @@ static int button_dispatch(sd_event_source *s, int fd, uint32_t revents, void *u
} else if (ev.code == SW_DOCK) {
log_struct(LOG_INFO,
LOG_MESSAGE("System docked."),
- LOG_MESSAGE_ID(SD_MESSAGE_SYSTEM_DOCKED),
+ "MESSAGE_ID=" SD_MESSAGE_SYSTEM_DOCKED_STR,
NULL);
b->docked = true;
@@ -212,7 +212,7 @@ static int button_dispatch(sd_event_source *s, int fd, uint32_t revents, void *u
if (ev.code == SW_LID) {
log_struct(LOG_INFO,
LOG_MESSAGE("Lid opened."),
- LOG_MESSAGE_ID(SD_MESSAGE_LID_OPENED),
+ "MESSAGE_ID=" SD_MESSAGE_LID_OPENED_STR,
NULL);
b->lid_closed = false;
@@ -221,7 +221,7 @@ static int button_dispatch(sd_event_source *s, int fd, uint32_t revents, void *u
} else if (ev.code == SW_DOCK) {
log_struct(LOG_INFO,
LOG_MESSAGE("System undocked."),
- LOG_MESSAGE_ID(SD_MESSAGE_SYSTEM_UNDOCKED),
+ "MESSAGE_ID=" SD_MESSAGE_SYSTEM_UNDOCKED_STR,
NULL);
b->docked = false;
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 26b6c3a92..971b447a7 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -34,7 +34,7 @@
#include "escape.h"
#include "fd-util.h"
#include "fileio-label.h"
-#include "formats-util.h"
+#include "format-util.h"
#include "fs-util.h"
#include "logind.h"
#include "mkdir.h"
@@ -1301,8 +1301,7 @@ static int flush_devices(Manager *m) {
} else {
struct dirent *de;
- while ((de = readdir(d))) {
-
+ FOREACH_DIRENT_ALL(de, d, break) {
if (!dirent_is_file(de))
continue;
@@ -1447,7 +1446,7 @@ static int bus_manager_log_shutdown(
p = strjoina(p, " (", m->wall_message, ").");
return log_struct(LOG_NOTICE,
- LOG_MESSAGE_ID(SD_MESSAGE_SHUTDOWN),
+ "MESSAGE_ID=" SD_MESSAGE_SHUTDOWN_STR,
p,
q,
NULL);
@@ -2465,13 +2464,9 @@ static int method_set_wall_message(
return 1; /* Will call us back */
#endif // 0
- if (isempty(wall_message))
- m->wall_message = mfree(m->wall_message);
- else {
- r = free_and_strdup(&m->wall_message, wall_message);
- if (r < 0)
- return log_oom();
- }
+ r = free_and_strdup(&m->wall_message, empty_to_null(wall_message));
+ if (r < 0)
+ return log_oom();
m->enable_wall_messages = enable_wall_messages;
diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c
index 194ebc1b7..92fa3c9c6 100644
--- a/src/login/logind-seat.c
+++ b/src/login/logind-seat.c
@@ -27,7 +27,7 @@
#include "alloc-util.h"
#include "fd-util.h"
#include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
#include "logind-acl.h"
#include "logind-seat.h"
#include "mkdir.h"
@@ -420,7 +420,7 @@ int seat_start(Seat *s) {
return 0;
log_struct(LOG_INFO,
- LOG_MESSAGE_ID(SD_MESSAGE_SEAT_START),
+ "MESSAGE_ID=" SD_MESSAGE_SEAT_START_STR,
"SEAT_ID=%s", s->id,
LOG_MESSAGE("New seat %s.", s->id),
NULL);
@@ -450,7 +450,7 @@ int seat_stop(Seat *s, bool force) {
if (s->started)
log_struct(LOG_INFO,
- LOG_MESSAGE_ID(SD_MESSAGE_SEAT_STOP),
+ "MESSAGE_ID=" SD_MESSAGE_SEAT_STOP_STR,
"SEAT_ID=%s", s->id,
LOG_MESSAGE("Removed seat %s.", s->id),
NULL);
@@ -547,8 +547,6 @@ int seat_attach_session(Seat *s, Session *session) {
LIST_PREPEND(sessions_by_seat, s->sessions, session);
seat_assign_position(s, session);
- seat_send_changed(s, "Sessions", NULL);
-
/* On seats with VTs, the VT logic defines which session is active. On
* seats without VTs, we automatically activate new sessions. */
if (!seat_has_vts(s))
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index 9123d50fa..bd2aac99a 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -35,7 +35,7 @@
#include "escape.h"
#include "fd-util.h"
#include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
#include "io-util.h"
#include "logind-session.h"
#include "mkdir.h"
@@ -592,7 +592,7 @@ int session_start(Session *s) {
return r;
log_struct(s->class == SESSION_BACKGROUND ? LOG_DEBUG : LOG_INFO,
- LOG_MESSAGE_ID(SD_MESSAGE_SESSION_START),
+ "MESSAGE_ID=" SD_MESSAGE_SESSION_START_STR,
"SESSION_ID=%s", s->id,
"USER_ID=%s", s->user->name,
"LEADER="PID_FMT, s->leader,
@@ -617,12 +617,10 @@ int session_start(Session *s) {
/* Send signals */
session_send_signal(s, true);
- user_send_changed(s->user, "Sessions", "Display", NULL);
+ user_send_changed(s->user, "Display", NULL);
if (s->seat) {
if (s->seat->active == s)
- seat_send_changed(s->seat, "Sessions", "ActiveSession", NULL);
- else
- seat_send_changed(s->seat, "Sessions", NULL);
+ seat_send_changed(s->seat, "ActiveSession", NULL);
}
return 0;
@@ -720,7 +718,7 @@ int session_finalize(Session *s) {
if (s->started)
log_struct(s->class == SESSION_BACKGROUND ? LOG_DEBUG : LOG_INFO,
- LOG_MESSAGE_ID(SD_MESSAGE_SESSION_STOP),
+ "MESSAGE_ID=" SD_MESSAGE_SESSION_STOP_STR,
"SESSION_ID=%s", s->id,
"USER_ID=%s", s->user->name,
"LEADER="PID_FMT, s->leader,
@@ -750,11 +748,10 @@ int session_finalize(Session *s) {
seat_set_active(s->seat, NULL);
seat_save(s->seat);
- seat_send_changed(s->seat, "Sessions", NULL);
}
user_save(s->user);
- user_send_changed(s->user, "Sessions", "Display", NULL);
+ user_send_changed(s->user, "Display", NULL);
return 0;
}