aboutsummaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorJohn Levon <john.levon@nutanix.com>2022-05-12 16:53:05 +0100
committerGitHub <noreply@github.com>2022-05-12 16:53:05 +0100
commitffdd1d68d9a8975f20d73637e4ff39bb64d00efb (patch)
treedea91978d255e8f640fb94a980fa69701c0cdfc2 /samples
parent294aa666fe09a8b6ca133201c7593c54d3cab6e8 (diff)
downloadlibvfio-user-ffdd1d68d9a8975f20d73637e4ff39bb64d00efb.zip
libvfio-user-ffdd1d68d9a8975f20d73637e4ff39bb64d00efb.tar.gz
libvfio-user-ffdd1d68d9a8975f20d73637e4ff39bb64d00efb.tar.bz2
run scan-build in CI (#680)
Yet another static analyzer pass, this one is used by SPDK, and as it did detect some minor issues, it's worth running. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'samples')
-rw-r--r--samples/client.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/samples/client.c b/samples/client.c
index 9f4a42b..492dd18 100644
--- a/samples/client.c
+++ b/samples/client.c
@@ -78,20 +78,20 @@ vfu_log(UNUSED vfu_ctx_t *vfu_ctx, UNUSED int level,
static int
init_sock(const char *path)
{
- int ret, sock;
- struct sockaddr_un addr = {.sun_family = AF_UNIX};
+ struct sockaddr_un addr = {.sun_family = AF_UNIX};
+ int sock;
- /* TODO path should be defined elsewhere */
- ret = snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", path);
+ /* TODO path should be defined elsewhere */
+ snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", path);
- if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
- err(EXIT_FAILURE, "failed to open socket %s", path);
- }
+ if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
+ err(EXIT_FAILURE, "failed to open socket %s", path);
+ }
- if ((ret = connect(sock, (struct sockaddr*)&addr, sizeof(addr))) == -1) {
- err(EXIT_FAILURE, "failed to connect server");
- }
- return sock;
+ if (connect(sock, (struct sockaddr*)&addr, sizeof(addr)) == -1) {
+ err(EXIT_FAILURE, "failed to connect server");
+ }
+ return sock;
}
static void