From 91010f0407a07caeacb11037bb5b493bab7ce203 Mon Sep 17 00:00:00 2001 From: AlexChen Date: Thu, 29 Oct 2020 14:03:52 +0800 Subject: vhost-user-blk/scsi: Fix broken error handling for socket call When socket() fails, it returns -1, 0 is the normal return value and should not return error. Reported-by: Euler Robot Signed-off-by: AlexChen Message-Id: <5F9A5B48.9030509@huawei.com> Reviewed-by: Raphael Norwitz Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- contrib/vhost-user-blk/vhost-user-blk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'contrib/vhost-user-blk') diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-blk/vhost-user-blk.c index caad88637e..dc981bf945 100644 --- a/contrib/vhost-user-blk/vhost-user-blk.c +++ b/contrib/vhost-user-blk/vhost-user-blk.c @@ -476,7 +476,7 @@ static int unix_sock_new(char *unix_fn) assert(unix_fn); sock = socket(AF_UNIX, SOCK_STREAM, 0); - if (sock <= 0) { + if (sock < 0) { perror("socket"); return -1; } -- cgit v1.2.3