diff options
author | dormando <dormando@rydia.net> | 2022-12-07 16:34:47 -0800 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2022-12-07 16:35:19 -0800 |
commit | 3cbd069ed883d1405c068d0bc104a2a0b2ebeecb (patch) | |
tree | 3e91dfae79ea4ba84b3da24d52bcb89b995887a8 /vendor | |
parent | 23ca8a0714273c650df0cb6e9034fc804553baab (diff) | |
download | memcached-3cbd069ed883d1405c068d0bc104a2a0b2ebeecb.tar.gz |
mcmc: track socket when disconnected
disconnect wasn't zeroing out the sockfd so it could've been called
twice in error/etc.
Diffstat (limited to 'vendor')
-rw-r--r-- | vendor/mcmc/mcmc.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/vendor/mcmc/mcmc.c b/vendor/mcmc/mcmc.c index ff400b6..3bd40b7 100644 --- a/vendor/mcmc/mcmc.c +++ b/vendor/mcmc/mcmc.c @@ -402,6 +402,7 @@ int mcmc_connect(void *c, char *host, char *port, int options) { memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; + ctx->fd = 0; s = getaddrinfo(host, port, &hints, &ai); @@ -655,6 +656,7 @@ int mcmc_disconnect(void *c) { // FIXME: I forget if 0 can be valid. if (ctx->fd != 0) { close(ctx->fd); + ctx->fd = 0; return MCMC_OK; } else { return MCMC_NOT_CONNECTED; |