]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
basic/cgroup-util: silence gcc warning about unitialized variable
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 31 Mar 2021 12:21:21 +0000 (14:21 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 31 Mar 2021 16:24:53 +0000 (18:24 +0200)
src/basic/cgroup-util.c

index 8dd3f8cd95018b46a9cef8800e3835e665b908da..8d3e5237a8cb9675911c8c7ef48770bbac8de1ee 100644 (file)
@@ -660,7 +660,7 @@ int cg_remove_xattr(const char *controller, const char *path, const char *name)
 
 int cg_pid_get_path(const char *controller, pid_t pid, char **ret_path) {
         _cleanup_fclose_ FILE *f = NULL;
-        const char *fs, *controller_str;
+        const char *fs, *controller_str = NULL; /* silence gcc warning about unitialized variable */
         int unified, r;
 
         assert(pid >= 0);
@@ -720,6 +720,7 @@ int cg_pid_get_path(const char *controller, pid_t pid, char **ret_path) {
                                 continue;
                         *e = 0;
 
+                        assert(controller_str);
                         r = string_contains_word(l, ",", controller_str);
                         if (r < 0)
                                 return r;