From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: AlexChen <alex.chen@huawei.com>,
Peter Maydell <peter.maydell@linaro.org>,
Raphael Norwitz <raphael.norwitz@nutanix.com>,
Euler Robot <euler.robot@huawei.com>
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 [thread overview]
Message-ID: <20201117091848.695370-8-mst@redhat.com> (raw)
In-Reply-To: <20201117091848.695370-1-mst@redhat.com>
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
next prev parent reply other threads:[~2020-11-17 9:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-17 9:18 [PULL v2 0/7] pc,vhost: fixes Michael S. Tsirkin
2020-11-17 9:19 ` [PULL v2 1/7] vhost-user: fix VHOST_USER_ADD/REM_MEM_REG truncation Michael S. Tsirkin
2020-11-17 9:19 ` [PULL v2 2/7] meson: move vhost_user_blk_server to meson.build Michael S. Tsirkin
2020-11-17 9:19 ` [PULL v2 3/7] vhost-user-blk-server: depend on CONFIG_VHOST_USER Michael S. Tsirkin
2020-11-17 9:19 ` [PULL v2 4/7] configure: mark vhost-user Linux-only Michael S. Tsirkin
2020-11-17 9:19 ` [PULL v2 5/7] hw/i386/acpi-build: Fix maybe-uninitialized error when ACPI hotplug off Michael S. Tsirkin
2020-11-17 9:19 ` [PULL v2 6/7] contrib/libvhost-user: Fix bad printf format specifiers Michael S. Tsirkin
2020-11-17 9:19 ` Michael S. Tsirkin [this message]
2020-11-17 14:12 ` [PULL v2 0/7] pc,vhost: fixes Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201117091848.695370-8-mst@redhat.com \
--to=mst@redhat.com \
--cc=alex.chen@huawei.com \
--cc=euler.robot@huawei.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=raphael.norwitz@nutanix.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).