]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
wrapper.c: Fix fprintf argument warning
authorTom Hromatka <tom.hromatka@oracle.com>
Mon, 12 Apr 2021 15:25:00 +0000 (09:25 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Mon, 12 Apr 2021 16:26:48 +0000 (10:26 -0600)
Fix a warning in cgroup_add_value_string() where '%d' was
being passed to fprintf when it should have been using '%ld'.

wrapper.c: In function ‘cgroup_add_value_string’:
wrapper.c:207:51: warning: format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘long unsigned int’ [-Wformat=]
  207 |    fprintf(stderr, "value exceeds the maximum of %d
      characters\n",
      |                                                  ~^
      |                                                   |
      |                                                   int
      |                                                  %ld
  208 |     sizeof(cntl_value->value) - 1);
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |     |
      |     long unsigned int

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/wrapper.c

index 966cb8490102048c989abfa1e47366079a883d46..98ebcc266c41f168b6865676d349499c7ff9e652 100644 (file)
@@ -204,7 +204,7 @@ int cgroup_add_value_string(struct cgroup_controller *controller,
 
        if (value) {
                if (strlen(value) >= sizeof(cntl_value->value)) {
-                       fprintf(stderr, "value exceeds the maximum of %d characters\n",
+                       fprintf(stderr, "value exceeds the maximum of %ld characters\n",
                                sizeof(cntl_value->value) - 1);
                        free(cntl_value);
                        return ECGCONFIGPARSEFAIL;