[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 7/7] vhost-user-blk/scsi: Fix broken error handling for socket
From: |
Michael S. Tsirkin |
Subject: |
[PULL v2 7/7] vhost-user-blk/scsi: Fix broken error handling for socket call |
Date: |
Tue, 17 Nov 2020 04:19:17 -0500 |
From: AlexChen <alex.chen@huawei.com>
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>
---
contrib/vhost-user-blk/vhost-user-blk.c | 2 +-
contrib/vhost-user-scsi/vhost-user-scsi.c | 2 +-
2 files changed, 2 insertions(+), 2 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;
}
diff --git a/contrib/vhost-user-scsi/vhost-user-scsi.c
b/contrib/vhost-user-scsi/vhost-user-scsi.c
index 3c912384e9..0f9ba4b2a2 100644
--- a/contrib/vhost-user-scsi/vhost-user-scsi.c
+++ b/contrib/vhost-user-scsi/vhost-user-scsi.c
@@ -320,7 +320,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;
}
--
MST
- [PULL v2 0/7] pc,vhost: fixes, Michael S. Tsirkin, 2020/11/17
- [PULL v2 1/7] vhost-user: fix VHOST_USER_ADD/REM_MEM_REG truncation, Michael S. Tsirkin, 2020/11/17
- [PULL v2 2/7] meson: move vhost_user_blk_server to meson.build, Michael S. Tsirkin, 2020/11/17
- [PULL v2 3/7] vhost-user-blk-server: depend on CONFIG_VHOST_USER, Michael S. Tsirkin, 2020/11/17
- [PULL v2 4/7] configure: mark vhost-user Linux-only, Michael S. Tsirkin, 2020/11/17
- [PULL v2 5/7] hw/i386/acpi-build: Fix maybe-uninitialized error when ACPI hotplug off, Michael S. Tsirkin, 2020/11/17
- [PULL v2 6/7] contrib/libvhost-user: Fix bad printf format specifiers, Michael S. Tsirkin, 2020/11/17
- [PULL v2 7/7] vhost-user-blk/scsi: Fix broken error handling for socket call,
Michael S. Tsirkin <=
- Re: [PULL v2 0/7] pc,vhost: fixes, Peter Maydell, 2020/11/17