diff options
author | unknown <cmiller@calliope.local> | 2006-03-17 18:46:34 +0100 |
---|---|---|
committer | unknown <cmiller@calliope.local> | 2006-03-17 18:46:34 +0100 |
commit | b835245e8380c68eff2608cc24846129bcf47d06 (patch) | |
tree | acb02ad16ddf827b3143538dcd7a18631a9de6c7 /vio/viosocket.c | |
parent | 5da3a478a10e67041687c1dc3a0b770fa5b41da0 (diff) | |
download | mariadb-git-b835245e8380c68eff2608cc24846129bcf47d06.tar.gz |
No longer leak file descriptors in mysql_close. Fixes Bug#15846.
vio/viosocket.c:
ORs were wrong to begin with, but more importantly, we mustn't use
shortable-circuit logic.
Also newly reap the connection-closed event handle.
Diffstat (limited to 'vio/viosocket.c')
-rw-r--r-- | vio/viosocket.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/vio/viosocket.c b/vio/viosocket.c index 5e0ed20b039..710f7a93607 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -560,14 +560,20 @@ int vio_close_shared_memory(Vio * vio) Close all handlers. UnmapViewOfFile and CloseHandle return non-zero result if they are success. */ - r= UnmapViewOfFile(vio->handle_map) || CloseHandle(vio->event_server_wrote) || - CloseHandle(vio->event_server_read) || CloseHandle(vio->event_client_wrote) || - CloseHandle(vio->event_client_read) || CloseHandle(vio->handle_file_map); - if (!r) - { - DBUG_PRINT("vio_error", ("close() failed, error: %d",r)); - /* FIXME: error handling (not critical for MySQL) */ - } + if (UnmapViewOfFile(vio->handle_map) == 0) + DBUG_PRINT("vio_error", ("UnmapViewOfFile() failed")); + if (CloseHandle(vio->event_server_wrote) == 0) + DBUG_PRINT("vio_error", ("CloseHandle(vio->esw) failed")); + if (CloseHandle(vio->event_server_read) == 0) + DBUG_PRINT("vio_error", ("CloseHandle(vio->esr) failed")); + if (CloseHandle(vio->event_client_wrote) == 0) + DBUG_PRINT("vio_error", ("CloseHandle(vio->ecw) failed")); + if (CloseHandle(vio->event_client_read) == 0) + DBUG_PRINT("vio_error", ("CloseHandle(vio->ecr) failed")); + if (CloseHandle(vio->handle_file_map) == 0) + DBUG_PRINT("vio_error", ("CloseHandle(vio->hfm) failed")); + if (CloseHandle(vio->event_conn_closed) == 0) + DBUG_PRINT("vio_error", ("CloseHandle(vio->ecc) failed")); } vio->type= VIO_CLOSED; vio->sd= -1; |