diff options
author | NIIBE Yutaka <[email protected]> | 2023-06-06 06:00:33 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2023-06-06 06:00:33 +0000 |
commit | 2f0232b15fdc5071e13a0f3595141cf813f4bfdf (patch) | |
tree | 5655e3da66c3c0402e143fa6183c60a5d641e24d | |
parent | w32: Fix hello_line parsing for fd passing. (diff) | |
download | libassuan-2f0232b15fdc5071e13a0f3595141cf813f4bfdf.tar.gz libassuan-2f0232b15fdc5071e13a0f3595141cf813f4bfdf.zip |
w32: Fix closing for non-socket HANDLE.
* src/system-w32.c (__assuan_close): Revert the change.
--
There are use cases where closing output_fd / input_fd which
may be not socket.
Fixes-commit: c93eb901e58d5b31294c2d452659b5150d95ec59
Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r-- | src/system-w32.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/system-w32.c b/src/system-w32.c index 52914e1..523300a 100644 --- a/src/system-w32.c +++ b/src/system-w32.c @@ -147,15 +147,10 @@ __assuan_pipe (assuan_context_t ctx, assuan_fd_t fd[2], int inherit_idx) int __assuan_close (assuan_context_t ctx, assuan_fd_t fd) { - int rc; - - if (ctx->flags.is_socket) - { - rc = closesocket (HANDLE2SOCKET(fd)); - if (rc) - gpg_err_set_errno ( _assuan_sock_wsa2errno (WSAGetLastError ()) ); - } - else + int rc = closesocket (HANDLE2SOCKET(fd)); + if (rc) + gpg_err_set_errno ( _assuan_sock_wsa2errno (WSAGetLastError ()) ); + if (rc && WSAGetLastError () == WSAENOTSOCK) { rc = CloseHandle (fd); if (rc) |