mirror of https://github.com/xemu-project/xemu.git
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>
This commit is contained in:
parent
5fd6921ccc
commit
91010f0407
|
@ -476,7 +476,7 @@ static int unix_sock_new(char *unix_fn)
|
||||||
assert(unix_fn);
|
assert(unix_fn);
|
||||||
|
|
||||||
sock = socket(AF_UNIX, SOCK_STREAM, 0);
|
sock = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||||
if (sock <= 0) {
|
if (sock < 0) {
|
||||||
perror("socket");
|
perror("socket");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -320,7 +320,7 @@ static int unix_sock_new(char *unix_fn)
|
||||||
assert(unix_fn);
|
assert(unix_fn);
|
||||||
|
|
||||||
sock = socket(AF_UNIX, SOCK_STREAM, 0);
|
sock = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||||
if (sock <= 0) {
|
if (sock < 0) {
|
||||||
perror("socket");
|
perror("socket");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue