]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
api: Fix clang warning
authorTom Hromatka <tom.hromatka@oracle.com>
Tue, 29 Jul 2025 16:09:05 +0000 (16:09 +0000)
committerKamalesh Babulal <kamalesh.babulal@oracle.com>
Fri, 1 Aug 2025 09:02:21 +0000 (14:32 +0530)
Fix the following clang warnings by initializing the char pointers to
NULL rather than '\0';

api.c:4232:46: warning: expression which evaluates to zero treated as a
null pointer constant of type 'char *' [-Wnon-literal-null-conversion]
 4232 |         char *controller_list[MAX_MNT_ELEMENTS] = { '\0' };
      |                                                     ^~~~
api.c:4233:40: warning: expression which evaluates to zero treated as a
null pointer constant of type 'char *' [-Wnon-literal-null-conversion]
 4233 |         char *cgrp_list[MAX_MNT_ELEMENTS] = { '\0' };
      |                                               ^~~~

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
src/api.c

index c2f07fc395763c1d6973441c5f0745208f7eda8e..234c5b4d60afcca57530b5755e531c8010971c30 100644 (file)
--- a/src/api.c
+++ b/src/api.c
@@ -4229,8 +4229,8 @@ static bool cgroup_is_rt_task(const pid_t pid)
 STATIC bool cgroup_compare_ignore_rule(const struct cgroup_rule * const rule, pid_t pid,
                                       const char * const procname)
 {
-       char *controller_list[MAX_MNT_ELEMENTS] = { '\0' };
-       char *cgrp_list[MAX_MNT_ELEMENTS] = { '\0' };
+       char *controller_list[MAX_MNT_ELEMENTS] = { NULL };
+       char *cgrp_list[MAX_MNT_ELEMENTS] = { NULL };
        int rule_matching_controller_idx;
        int cgrp_list_matching_idx = 0;
        bool found_match = false;