]> sourceware.org Git - lvm2.git/commitdiff
coverity: easier to follow set-up of vsn variable
authorZdenek Kabelac <zkabelac@redhat.com>
Tue, 12 Jul 2016 14:41:25 +0000 (16:41 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Wed, 13 Jul 2016 19:52:14 +0000 (21:52 +0200)
Helping coverity to see 'vsn' really can't be NULL.

tools/dumpconfig.c

index 3da04f077a55dc2614fa7a14e1ac08dcdb6ee283..e387e60a00640ba22a2a5c33f4f8c55522bbbe84 100644 (file)
@@ -20,11 +20,8 @@ static int _get_vsn(struct cmd_context *cmd, uint16_t *version_int)
        const char *vsn;
        unsigned int major, minor, patchlevel;
 
-       if (arg_is_set(cmd, atversion_ARG))
-               vsn = arg_str_value(cmd, atversion_ARG, NULL);
-       else if (arg_is_set(cmd, sinceversion_ARG))
-               vsn = arg_str_value(cmd, sinceversion_ARG, NULL);
-       else
+       if (!(vsn = arg_str_value(cmd, atversion_ARG, NULL)) &&
+           !(vsn = arg_str_value(cmd, sinceversion_ARG, NULL)))
                vsn = LVM_VERSION;
 
        if (sscanf(vsn, "%u.%u.%u", &major, &minor, &patchlevel) != 3) {
This page took 0.032065 seconds and 5 git commands to generate.