summaryrefslogtreecommitdiffstats
path: root/src/vmspawn
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-07-11 14:34:42 +0200
committerLennart Poettering <lennart@poettering.net>2024-07-12 06:27:45 +0200
commit8c6a7fa6d9b8b0179becb0e6da80203fdd991edc (patch)
tree9391e38376af5df47d9d080ae55d7f1ba052bfcc /src/vmspawn
parentvmspawn: rework how AF_VSOCK/SOCK_STREAM notifications are read (diff)
downloadsystemd-8c6a7fa6d9b8b0179becb0e6da80203fdd991edc.tar.xz
systemd-8c6a7fa6d9b8b0179becb0e6da80203fdd991edc.zip
vmspawn: get rid of an unnecessary local variable
Diffstat (limited to 'src/vmspawn')
-rw-r--r--src/vmspawn/vmspawn.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/vmspawn/vmspawn.c b/src/vmspawn/vmspawn.c
index 77100f59c2..cb42085d76 100644
--- a/src/vmspawn/vmspawn.c
+++ b/src/vmspawn/vmspawn.c
@@ -582,24 +582,20 @@ static int parse_argv(int argc, char *argv[]) {
}
static int open_vsock(void) {
- _cleanup_close_ int vsock_fd = -EBADF;
- int r;
static const union sockaddr_union bind_addr = {
.vm.svm_family = AF_VSOCK,
.vm.svm_cid = VMADDR_CID_ANY,
.vm.svm_port = VMADDR_PORT_ANY,
};
- vsock_fd = socket(AF_VSOCK, SOCK_STREAM|SOCK_CLOEXEC, 0);
+ _cleanup_close_ int vsock_fd = socket(AF_VSOCK, SOCK_STREAM|SOCK_CLOEXEC, 0);
if (vsock_fd < 0)
return log_error_errno(errno, "Failed to open AF_VSOCK socket: %m");
- r = bind(vsock_fd, &bind_addr.sa, sizeof(bind_addr.vm));
- if (r < 0)
+ if (bind(vsock_fd, &bind_addr.sa, sizeof(bind_addr.vm)) < 0)
return log_error_errno(errno, "Failed to bind to VSOCK address %u:%u: %m", bind_addr.vm.svm_cid, bind_addr.vm.svm_port);
- r = listen(vsock_fd, SOMAXCONN_DELUXE);
- if (r < 0)
+ if (listen(vsock_fd, SOMAXCONN_DELUXE) < 0)
return log_error_errno(errno, "Failed to listen on VSOCK: %m");
return TAKE_FD(vsock_fd);