rpc: only unlink unix domain socket if *we* have created it

We used to unlink the unix domain socket
regardless of who created it. Even we
got the "socket already exists" error
on init, we would still unlink the socket
on shutdown.

Change-Id: Ib14382d6d7e127d8f51f6544cbb063594e040879
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/388284
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2017-11-20 22:13:43 +01:00 committed by Jim Harris
parent 5bdbe36ee9
commit f53d6c7a43

View File

@ -175,12 +175,12 @@ spdk_rpc_register_method(const char *method, spdk_rpc_method_handler func)
void
spdk_rpc_close(void)
{
if (g_rpc_listen_addr_unix.sun_path[0]) {
/* Delete the Unix socket file */
unlink(g_rpc_listen_addr_unix.sun_path);
}
if (g_jsonrpc_server) {
if (g_rpc_listen_addr_unix.sun_path[0]) {
/* Delete the Unix socket file */
unlink(g_rpc_listen_addr_unix.sun_path);
}
spdk_jsonrpc_server_shutdown(g_jsonrpc_server);
}
}