vhost-user-scsi: avoid unlink(NULL) with fd passing
commit6852c21db229c4bf4c1db772444bdfbbd027e5b8
authorStefan Hajnoczi <stefanha@redhat.com>
Mon, 16 May 2022 15:57:01 +0000 (16 16:57 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 16 May 2022 20:48:35 +0000 (16 16:48 -0400)
tree5e1c17b78c6867e2ebce07d8708e9df0f38997e0
parent2a7888cc3aa31faee839fa5dddad354ff8941f4c
vhost-user-scsi: avoid unlink(NULL) with fd passing

Commit 747421e949fc1eb3ba66b5fcccdb7ba051918241 ("Implements Backend
Program conventions for vhost-user-scsi") introduced fd-passing support
as part of implementing the vhost-user backend program conventions.

When fd passing is used the UNIX domain socket path is NULL and we must
not call unlink(2).

The unlink(2) call is necessary when the listen socket, lsock, was
created successfully since that means the UNIX domain socket is visible
in the file system.

Fixes: Coverity CID 1488353
Fixes: 747421e949fc1eb3ba66b5fcccdb7ba051918241 ("Implements Backend Program conventions for vhost-user-scsi")
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20220516155701.1789638-1-stefanha@redhat.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-scsi/vhost-user-scsi.c