[dpdk-dev] [PATCH] vhost: unlink existing file for server mode

Zhiyong Yang zhiyong.yang at intel.com
Fri Feb 2 09:39:14 CET 2018


Vhost-user startup will fail based on server mode, if the specified
socket file has already existed. The patch introduces function
unlink() to remove the possible existing file.

Cc: yliu at fridaylinux.org
Cc: maxime.coquelin at redhat.com

Signed-off-by: Zhiyong Yang <zhiyong.yang at intel.com>
---
 lib/librte_vhost/socket.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c
index 6e3857e7a..324a24f4e 100644
--- a/lib/librte_vhost/socket.c
+++ b/lib/librte_vhost/socket.c
@@ -315,6 +315,7 @@ vhost_user_start_server(struct vhost_user_socket *vsocket)
 	int fd = vsocket->socket_fd;
 	const char *path = vsocket->path;
 
+	unlink(path);
 	ret = bind(fd, (struct sockaddr *)&vsocket->un, sizeof(vsocket->un));
 	if (ret < 0) {
 		RTE_LOG(ERR, VHOST_CONFIG,
-- 
2.13.3



More information about the dev mailing list