]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
macro: add LXC_AUDS_ADDR_LEN
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 25 Aug 2018 05:24:37 +0000 (07:24 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 28 Aug 2018 18:14:52 +0000 (20:14 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/commands.c
src/lxc/commands_utils.c
src/lxc/macro.h

index 30d6b6047aae2304a16464af2fe9037241585589..0eeb1b5be0b7d0521a8c0de2a8cb69fd222772bc 100644 (file)
@@ -1234,7 +1234,7 @@ out_close:
 int lxc_cmd_init(const char *name, const char *lxcpath, const char *suffix)
 {
        int fd, len, ret;
-       char path[sizeof(((struct sockaddr_un *)0)->sun_path)] = {0};
+       char path[LXC_AUDS_ADDR_LEN] = {0};
        char *offset = &path[1];
 
        /* -2 here because this is an abstract unix socket so it needs a
index 854d90ce5be7b67cc37923440c38c2a3291f8e73..c6544631ddb8d7341fba4af0f32ea8a5305bc5dd 100644 (file)
@@ -162,7 +162,7 @@ int lxc_cmd_connect(const char *name, const char *lxcpath,
                    const char *hashed_sock_name, const char *suffix)
 {
        int ret, client_fd;
-       char path[sizeof(((struct sockaddr_un *)0)->sun_path)] = {0};
+       char path[LXC_AUDS_ADDR_LEN] = {0};
        char *offset = &path[1];
 
        /* -2 here because this is an abstract unix socket so it needs a
index d6e8712729228915937b9f66af0ad59c2858e55b..aa1d5478cffe21833fb44224ee2bce63319d102e 100644 (file)
@@ -30,6 +30,7 @@
 #include <string.h>
 #include <sys/mount.h>
 #include <sys/socket.h>
+#include <sys/un.h>
 
 /* Define __S_ISTYPE if missing from the C library. */
 #ifndef __S_ISTYPE
@@ -238,6 +239,9 @@ extern int __build_bug_on_failed;
 #define MACVLAN_MODE_PASSTHRU 8
 #endif
 
+/* Length of abstract unix domain socket socket address. */
+#define LXC_AUDS_ADDR_LEN sizeof(((struct sockaddr_un *)0)->sun_path)
+
 /* mount */
 #ifndef MS_REC
 #define MS_REC 16384