mirror of
https://github.com/systemd/systemd.git
synced 2024-11-23 18:23:32 +08:00
Merge pull request #502 from keszybz/login-small-cleanup
Login small cleanup
This commit is contained in:
commit
7e59232f31
@ -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;
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user