mirror of
https://github.com/haiwen/libsearpc.git
synced 2025-04-27 18:25:06 +00:00
Close socket when failed to connect name pipe (#65)
Co-authored-by: heran yang <heran.yang@seafile.com>
This commit is contained in:
parent
d6ba8f60dc
commit
783141fb69
@ -333,6 +333,7 @@ int searpc_named_pipe_client_connect(SearpcNamedPipeClient *client)
|
||||
g_strlcpy (servaddr.sun_path, client->path, sizeof(servaddr.sun_path));
|
||||
if (connect(client->pipe_fd, (struct sockaddr *)&servaddr, (socklen_t)sizeof(servaddr)) < 0) {
|
||||
g_warning ("pipe client failed to connect to server: %s\n", strerror(errno));
|
||||
close(client->pipe_fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -364,6 +365,7 @@ int searpc_named_pipe_client_connect(SearpcNamedPipeClient *client)
|
||||
DWORD mode = PIPE_READMODE_MESSAGE;
|
||||
if (!SetNamedPipeHandleState(pipe_fd, &mode, NULL, NULL)) {
|
||||
G_WARNING_WITH_LAST_ERROR("Failed to set named pipe mode");
|
||||
CloseHandle (pipe_fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user