]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgroups: use %zu format specifier to print size_t 1301/head
authorChristian Brauner <christian.brauner@canonical.com>
Tue, 15 Nov 2016 05:19:55 +0000 (06:19 +0100)
committerChristian Brauner <christian.brauner@canonical.com>
Tue, 15 Nov 2016 05:19:55 +0000 (06:19 +0100)
Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
src/lxc/cgroups/cgfsng.c

index 1e383350aac8a4adf40bc3f4d205d81d751b0d80..57a13dc77fbd5205bab42a3ce1c4730792cd774c 100644 (file)
@@ -358,20 +358,21 @@ static uint32_t *lxc_cpumask(char *buf, size_t nbits)
 }
 
 /* The largest integer that can fit into long int is 2^64. This is a
- * 20-digit number. */
-#define LEN 21
+ * 20-digit number.
+ */
+#define __IN_TO_STR_LEN 21
 /* Turn cpumask into simple, comma-separated cpulist. */
 static char *lxc_cpumask_to_cpulist(uint32_t *bitarr, size_t nbits)
 {
        size_t i;
        int ret;
-       char numstr[LEN] = {0};
+       char numstr[__IN_TO_STR_LEN] = {0};
        char **cpulist = NULL;
 
        for (i = 0; i <= nbits; i++) {
                if (is_set(i, bitarr)) {
-                       ret = snprintf(numstr, LEN, "%lu", i);
-                       if (ret < 0 || (size_t)ret >= LEN) {
+                       ret = snprintf(numstr, __IN_TO_STR_LEN, "%zu", i);
+                       if (ret < 0 || (size_t)ret >= __IN_TO_STR_LEN) {
                                lxc_free_array((void **)cpulist, free);
                                return NULL;
                        }