summaryrefslogtreecommitdiffstats
path: root/contrib/vhost-user-blk
diff options
context:
space:
mode:
authorAlexChen2020-10-29 07:03:52 +0100
committerMichael S. Tsirkin2020-11-17 10:16:55 +0100
commit91010f0407a07caeacb11037bb5b493bab7ce203 (patch)
tree209aa0fdd3aeb59e5abb6e52eed8d50505451161 /contrib/vhost-user-blk
parentcontrib/libvhost-user: Fix bad printf format specifiers (diff)
downloadqemu-91010f0407a07caeacb11037bb5b493bab7ce203.tar.gz
qemu-91010f0407a07caeacb11037bb5b493bab7ce203.tar.xz
qemu-91010f0407a07caeacb11037bb5b493bab7ce203.zip
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 <euler.robot@huawei.com> Signed-off-by: AlexChen <alex.chen@huawei.com> Message-Id: <5F9A5B48.9030509@huawei.com> Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'contrib/vhost-user-blk')
-rw-r--r--contrib/vhost-user-blk/vhost-user-blk.c2
1 files changed, 1 insertions, 1 deletions
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;
}