From: Christian Brauner Date: Thu, 9 Apr 2020 10:49:16 +0000 (+0200) Subject: conf: use macros all around in lxc_map_ids() X-Git-Tag: lxc-5.0.0~460^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6ba8981f5a0fc69b84e2b35786f1264b7d5b334;p=thirdparty%2Flxc.git conf: use macros all around in lxc_map_ids() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index 4fe64770c..193df3327 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -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;