mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-01-06 14:21:55 +03:00
pkd_daemon.c: force close pkd_state.server_fd upon stop
There's a race window between the accept loop's call to accept(2) and it checking `ctx.keep_going`. Forcefully close the server socket such that any raced `accept` ends up failing. Signed-off-by: Jon Simons <jon@jonsimons.org> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
8d7563a9c3
commit
9003f92e8f
@@ -498,6 +498,7 @@ void pkd_stop(struct pkd_result *out) {
|
||||
int rc = 0;
|
||||
|
||||
ctx.keep_going = 0;
|
||||
close(pkd_state.server_fd);
|
||||
|
||||
rc = pthread_kill(ctx.tid, SIGUSR1);
|
||||
assert_int_equal(rc, 0);
|
||||
|
||||
Reference in New Issue
Block a user