]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgroups: fix build warning on GCC 7 3349/head
authorAleksa Sarai <cyphar@cyphar.com>
Thu, 2 Apr 2020 15:13:11 +0000 (02:13 +1100)
committerAleksa Sarai <cyphar@cyphar.com>
Thu, 2 Apr 2020 15:13:11 +0000 (02:13 +1100)
GCC 7 appears to be clever enough to detect that transient_len is
uninitialised but not that it won't be used despite [1]. Just initialise
it to zero to stop the complaining, and allow LXC to build on openSUSE
Leap.

[1]: 346830421a96 ("cgroups: fix "uninitialized transient_len" warning")

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
src/lxc/cgroups/cgfsng.c

index 21c2c3f7cec59093bb10432a508f9adbcee8f026..d3595bcdf9ee4e76d99bb4a010156b242f028302 100644 (file)
@@ -1360,7 +1360,7 @@ __cgfsng_ops static inline bool cgfsng_payload_create(struct cgroup_ops *ops,
 __cgfsng_ops static bool cgfsng_monitor_enter(struct cgroup_ops *ops,
                                              struct lxc_handler *handler)
 {
-       int monitor_len, transient_len;
+       int monitor_len, transient_len = 0;
        char monitor[INTTYPE_TO_STRLEN(pid_t)],
            transient[INTTYPE_TO_STRLEN(pid_t)];