diff options
author | unknown <cmiller@zippy.cornsilk.net> | 2006-09-08 11:39:03 -0400 |
---|---|---|
committer | unknown <cmiller@zippy.cornsilk.net> | 2006-09-08 11:39:03 -0400 |
commit | e44a92325437caafc8034d6a90527e25285ba73f (patch) | |
tree | 90e8f6251baa95b44953f08aa08d718db079cb8c | |
parent | 12eb42acf98d1594b9e50dbbf0c77d82f95279ed (diff) | |
download | mariadb-git-e44a92325437caafc8034d6a90527e25285ba73f.tar.gz |
Fix initialized memory. Count the number of failures in shm-closing
functions and return it.
vio/viosocket.c:
Initialize the return code and set it according to errors in the closing
functions.
-rw-r--r-- | vio/viosocket.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/vio/viosocket.c b/vio/viosocket.c index 710f7a93607..f4cc6dfdfb0 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -545,9 +545,13 @@ int vio_write_shared_memory(Vio * vio, const gptr buf, int size) } +/** + Close shared memory and DBUG_PRINT any errors that happen on closing. + @return Zero if all closing functions succeed, and nonzero otherwise. +*/ int vio_close_shared_memory(Vio * vio) { - int r; + int error_count= 0; DBUG_ENTER("vio_close_shared_memory"); if (vio->type != VIO_CLOSED) { @@ -561,23 +565,44 @@ int vio_close_shared_memory(Vio * vio) result if they are success. */ if (UnmapViewOfFile(vio->handle_map) == 0) + { + error_count++; DBUG_PRINT("vio_error", ("UnmapViewOfFile() failed")); + } if (CloseHandle(vio->event_server_wrote) == 0) + { + error_count++; DBUG_PRINT("vio_error", ("CloseHandle(vio->esw) failed")); + } if (CloseHandle(vio->event_server_read) == 0) + { + error_count++; DBUG_PRINT("vio_error", ("CloseHandle(vio->esr) failed")); + } if (CloseHandle(vio->event_client_wrote) == 0) + { + error_count++; DBUG_PRINT("vio_error", ("CloseHandle(vio->ecw) failed")); + } if (CloseHandle(vio->event_client_read) == 0) + { + error_count++; DBUG_PRINT("vio_error", ("CloseHandle(vio->ecr) failed")); + } if (CloseHandle(vio->handle_file_map) == 0) + { + error_count++; DBUG_PRINT("vio_error", ("CloseHandle(vio->hfm) failed")); + } if (CloseHandle(vio->event_conn_closed) == 0) + { + error_count++; DBUG_PRINT("vio_error", ("CloseHandle(vio->ecc) failed")); + } } vio->type= VIO_CLOSED; vio->sd= -1; - DBUG_RETURN(!r); + DBUG_RETURN(error_count); } #endif /* HAVE_SMEM */ #endif /* __WIN__ */ |