]> git.proxmox.com Git - mirror_lxc.git/commitdiff
conf: use macros all around in lxc_map_ids()
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 9 Apr 2020 10:49:16 +0000 (12:49 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 9 Apr 2020 10:49:16 +0000 (12:49 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/conf.c

index 4fe64770c5b1e1037a37830ea992cad53dc48adf..193df3327f494933fa0aaf932a01e20a1ebab32c 100644 (file)
@@ -2679,19 +2679,10 @@ int lxc_map_ids(struct lxc_list *idmap, pid_t pid)
        struct id_map *map;
        struct lxc_list *iterator;
        enum idtype type;
-       /* strlen("new@idmap") = 9
-        * +
-        * strlen(" ") = 1
-        * +
-        * INTTYPE_TO_STRLEN(uint32_t)
-        * +
-        * strlen(" ") = 1
-        *
-        * We add some additional space to make sure that we really have
-        * LXC_IDMAPLEN bytes available for our the {g,u]id mapping.
-        */
        int ret = 0, gidmap = 0, uidmap = 0;
-       char mapbuf[9 + 1 + INTTYPE_TO_STRLEN(uint32_t) + 1 + LXC_IDMAPLEN] = {0};
+       char mapbuf[STRLITERALLEN("new@idmap") + STRLITERALLEN(" ") +
+                   INTTYPE_TO_STRLEN(pid_t) + STRLITERALLEN(" ") +
+                   LXC_IDMAPLEN] = {0};
        bool had_entry = false, use_shadow = false;
        int hostuid, hostgid;