diff options
author | Daniel Mack <github@zonque.org> | 2015-07-06 20:45:17 -0400 |
---|---|---|
committer | Daniel Mack <github@zonque.org> | 2015-07-06 20:45:17 -0400 |
commit | 7e59232f3171ed45e5fef90e0b6af96fa384324e (patch) | |
tree | a702d880f89470d1b5bedd9f5cede93f6d3d5fde | |
parent | fc08079ef25a063f56be48b87035f8fde79153ba (diff) | |
parent | 554939821674ff7a5cd3f2900aab1426921fa2e1 (diff) |
Merge pull request #502 from keszybz/login-small-cleanup
Login small cleanup
-rw-r--r-- | src/login/logind-dbus.c | 4 | ||||
-rw-r--r-- | src/login/logind-seat.c | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 659ce18a48..0cc2cdf997 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -690,8 +690,8 @@ static int method_create_session(sd_bus_message *message, void *userdata, sd_bus } manager_get_session_by_pid(m, leader, &session); - if (!session && vtnr > 0) - session = (vtnr < m->seat0->position_count) ? m->seat0->positions[vtnr] : NULL; + if (!session && vtnr > 0 && vtnr < m->seat0->position_count) + session = m->seat0->positions[vtnr]; if (session) { _cleanup_free_ char *path = NULL; _cleanup_close_ int fifo_fd = -1; diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c index 23095f51e0..fb5d076311 100644 --- a/src/login/logind-seat.c +++ b/src/login/logind-seat.c @@ -269,7 +269,7 @@ int seat_set_active(Seat *s, Session *session) { int seat_switch_to(Seat *s, unsigned int num) { /* Public session positions skip 0 (there is only F1-F12). Maybe it * will get reassigned in the future, so return error for now. */ - if (!num) + if (num == 0) return -EINVAL; if (num >= s->position_count || !s->positions[num]) { @@ -286,7 +286,7 @@ int seat_switch_to(Seat *s, unsigned int num) { int seat_switch_to_next(Seat *s) { unsigned int start, i; - if (!s->position_count) + if (s->position_count == 0) return -EINVAL; start = 1; @@ -307,7 +307,7 @@ int seat_switch_to_next(Seat *s) { int seat_switch_to_previous(Seat *s) { unsigned int start, i; - if (!s->position_count) + if (s->position_count == 0) return -EINVAL; start = 1; @@ -476,7 +476,7 @@ void seat_evict_position(Seat *s, Session *session) { session->pos = 0; - if (!pos) + if (pos == 0) return; if (pos < s->position_count && s->positions[pos] == session) { |