]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
nspawn: fix type to pass to connect()
authorLennart Poettering <lennart@poettering.net>
Wed, 1 Sep 2021 12:41:37 +0000 (14:41 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 1 Sep 2021 23:27:46 +0000 (08:27 +0900)
It expects a generic "struct sockaddr", not a "struct sockaddr_un".
Pass the right member of the union.

Not sure why gcc/llvm never complained about this...

src/nspawn/nspawn.c

index f3d06d70d44470a8561be74247d67cbeafbf2581..0966db4abe5f447bd6bbd847eb4416debd9cbec5 100644 (file)
@@ -5345,7 +5345,7 @@ static int cant_be_in_netns(void) {
         if (fd < 0)
                 return log_error_errno(errno, "Failed to allocate udev control socket: %m");
 
-        if (connect(fd, &sa.un, SOCKADDR_UN_LEN(sa.un)) < 0) {
+        if (connect(fd, &sa.sa, SOCKADDR_UN_LEN(sa.un)) < 0) {
 
                 if (errno == ENOENT || ERRNO_IS_DISCONNECT(errno))
                         return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),