mirror of
https://github.com/systemd/systemd.git
synced 2025-02-25 21:57:32 +03:00
logind: add missing asserts
This commit is contained in:
parent
2d7cbead01
commit
a8d5378a88
@ -1293,6 +1293,8 @@ int session_kill(Session *s, KillWho who, int signo) {
|
|||||||
static int session_open_vt(Session *s) {
|
static int session_open_vt(Session *s) {
|
||||||
char path[sizeof("/dev/tty") + DECIMAL_STR_MAX(s->vtnr)];
|
char path[sizeof("/dev/tty") + DECIMAL_STR_MAX(s->vtnr)];
|
||||||
|
|
||||||
|
assert(s);
|
||||||
|
|
||||||
if (s->vtnr < 1)
|
if (s->vtnr < 1)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
@ -1311,6 +1313,8 @@ static int session_prepare_vt(Session *s) {
|
|||||||
int vt, r;
|
int vt, r;
|
||||||
struct vt_mode mode = {};
|
struct vt_mode mode = {};
|
||||||
|
|
||||||
|
assert(s);
|
||||||
|
|
||||||
if (s->vtnr < 1)
|
if (s->vtnr < 1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -1366,6 +1370,8 @@ error:
|
|||||||
static void session_restore_vt(Session *s) {
|
static void session_restore_vt(Session *s) {
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
assert(s);
|
||||||
|
|
||||||
if (s->vtfd < 0)
|
if (s->vtfd < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1444,6 +1450,8 @@ static void session_release_controller(Session *s, bool notify) {
|
|||||||
_unused_ _cleanup_free_ char *name = NULL;
|
_unused_ _cleanup_free_ char *name = NULL;
|
||||||
SessionDevice *sd;
|
SessionDevice *sd;
|
||||||
|
|
||||||
|
assert(s);
|
||||||
|
|
||||||
if (!s->controller)
|
if (!s->controller)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -438,6 +438,8 @@ static int manager_attach_fds(Manager *m) {
|
|||||||
/* Upon restart, PID1 will send us back all fds of session devices that we previously opened. Each
|
/* Upon restart, PID1 will send us back all fds of session devices that we previously opened. Each
|
||||||
* file descriptor is associated with a given session. The session ids are passed through FDNAMES. */
|
* file descriptor is associated with a given session. The session ids are passed through FDNAMES. */
|
||||||
|
|
||||||
|
assert(m);
|
||||||
|
|
||||||
n = sd_listen_fds_with_names(true, &fdnames);
|
n = sd_listen_fds_with_names(true, &fdnames);
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
return log_warning_errno(n, "Failed to acquire passed fd list: %m");
|
return log_warning_errno(n, "Failed to acquire passed fd list: %m");
|
||||||
@ -668,7 +670,7 @@ static int manager_connect_bus(Manager *m) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int manager_vt_switch(sd_event_source *src, const struct signalfd_siginfo *si, void *data) {
|
static int manager_vt_switch(sd_event_source *src, const struct signalfd_siginfo *si, void *data) {
|
||||||
Manager *m = data;
|
Manager *m = ASSERT_PTR(data);
|
||||||
Session *active;
|
Session *active;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user