client: Sanitize shutdown/kill mechanism
This commit is contained in:
parent
a8204ebcea
commit
db36f0dfe8
2 changed files with 3 additions and 6 deletions
|
@ -76,8 +76,6 @@ void client_kill(struct client *client) {
|
|||
assert(client);
|
||||
if (client->connection.fd != -1) {
|
||||
shutdown(client->connection.fd, SHUT_RDWR);
|
||||
close(client->connection.fd);
|
||||
client->connection.fd = -1;
|
||||
};
|
||||
if (client->seat != NULL) {
|
||||
seat_remove_client(client);
|
||||
|
@ -96,7 +94,6 @@ void client_destroy(struct client *client) {
|
|||
client->event_source = NULL;
|
||||
}
|
||||
if (client->connection.fd != -1) {
|
||||
shutdown(client->connection.fd, SHUT_RDWR);
|
||||
close(client->connection.fd);
|
||||
client->connection.fd = -1;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ void seat_destroy(struct seat *seat) {
|
|||
while (!linked_list_empty(&seat->clients)) {
|
||||
struct client *client = (struct client *)seat->clients.next;
|
||||
// This will cause the client to remove itself from the seat
|
||||
assert(client->seat);
|
||||
assert(client->seat == seat);
|
||||
client_kill(client);
|
||||
}
|
||||
assert(seat->curttyfd == -1);
|
||||
|
@ -367,7 +367,7 @@ int seat_open_client(struct seat *seat, struct client *client) {
|
|||
|
||||
seat->active_client = client;
|
||||
if (client_send_enable_seat(client) == -1) {
|
||||
seat_remove_client(client);
|
||||
log_error("could not send enable signal");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -428,7 +428,7 @@ static int seat_disable_client(struct client *client) {
|
|||
|
||||
client->pending_disable = true;
|
||||
if (client_send_disable_seat(seat->active_client) == -1) {
|
||||
seat_remove_client(client);
|
||||
log_error("could not send disable event");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue