]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
wdctl: mark flags field as unsigned long
authorThomas Weißschuh <thomas@t-8ch.de>
Sun, 8 Jan 2023 03:29:51 +0000 (03:29 +0000)
committerThomas Weißschuh <thomas@t-8ch.de>
Sun, 8 Jan 2023 16:28:48 +0000 (16:28 +0000)
This is required by string_to_bitmask().
The previous cast failed on s390x with the following warning:

In function 'string_to_bitmask',
    inlined from 'string_to_bitmask' at lib/strutils.c:802:5,
    inlined from 'main' at sys-utils/wdctl.c:770:8:
lib/strutils.c:829:23: error: write of 64-bit data outside the bound of destination object, data truncated into 32-bit [-Werror=extra]
  829 |                 *mask |= flag;
      |

sys-utils/wdctl.c

index a22a59ad37e45130b5d9e205379c8f56d3d93e0f..591d538c221ab8624fb09ceb41a7c498b7121cd9 100644 (file)
@@ -713,7 +713,7 @@ int main(int argc, char *argv[])
        struct wd_device wd;
        struct wd_control ctl = { .hide_headings = 0 };
        int c, res = EXIT_SUCCESS, count = 0;
-       uint32_t wanted = 0;
+       unsigned long wanted = 0;
        const char *dflt_device = NULL;
 
        static const struct option long_opts[] = {
@@ -767,7 +767,7 @@ int main(int argc, char *argv[])
                        ctl.set_pretimeout = 1;
                        break;
                case 'f':
-                       if (string_to_bitmask(optarg, (unsigned long *) &wanted, name2bit) != 0)
+                       if (string_to_bitmask(optarg, &wanted, name2bit) != 0)
                                return EXIT_FAILURE;
                        break;
                case 'F':