diff options
author | Jon Simons <jon@jonsimons.org> | 2017-09-09 20:12:35 -0700 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2017-09-11 16:31:01 +0200 |
commit | 9003f92e8f3df333a033a345203a9f7a88917bdd (patch) | |
tree | 3529785b3a616df652aa76160a13561f191cf2ac /tests | |
parent | 8d7563a9c3a02a05e09950cc5445d2c6bc2fc9aa (diff) | |
download | libssh-9003f92e8f3df333a033a345203a9f7a88917bdd.tar.gz libssh-9003f92e8f3df333a033a345203a9f7a88917bdd.tar.xz libssh-9003f92e8f3df333a033a345203a9f7a88917bdd.zip |
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>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/pkd/pkd_daemon.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/pkd/pkd_daemon.c b/tests/pkd/pkd_daemon.c index 3a530793..9860ca56 100644 --- a/tests/pkd/pkd_daemon.c +++ b/tests/pkd/pkd_daemon.c @@ -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); |