diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-20 15:22:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-20 15:22:35 +0000 |
commit | 5d14aabf1d1d96dd8f6ec594ee65863ddbfc087a (patch) | |
tree | e2579d97e9db101bab6d2512206b2911d91f7c35 /src/sss_client/common.c | |
parent | Adding debian version 2.9.4-2. (diff) | |
download | sssd-5d14aabf1d1d96dd8f6ec594ee65863ddbfc087a.tar.xz sssd-5d14aabf1d1d96dd8f6ec594ee65863ddbfc087a.zip |
Merging upstream version 2.9.5.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/sss_client/common.c')
-rw-r--r-- | src/sss_client/common.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/sss_client/common.c b/src/sss_client/common.c index 702d059..32555ed 100644 --- a/src/sss_client/common.c +++ b/src/sss_client/common.c @@ -93,8 +93,22 @@ void sss_cli_close_socket(void) #ifdef HAVE_PTHREAD_EXT static void sss_at_thread_exit(void *v) { - sss_cli_close_socket(); + /* At this point the key value is already set to NULL and the only way to + * access the data from the value is via the argument passed to the + * destructor (sss_at_thread_exit). See e.g. + * https://www.man7.org/linux/man-pages/man3/pthread_key_create.3p.html + * for details. */ + + struct sss_socket_descriptor_t *descriptor = (struct sss_socket_descriptor_t *) v; + + if (descriptor->sd != -1) { + close(descriptor->sd); + descriptor->sd = -1; + } + free(v); + + /* Most probably redudant, but better safe than sorry. */ pthread_setspecific(sss_sd_key, NULL); } |