]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
swaplabel: check blkid_probe_lookup_value() result [coverity scan]
authorKarel Zak <kzak@redhat.com>
Thu, 21 Jun 2012 10:54:31 +0000 (12:54 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 21 Jun 2012 10:54:31 +0000 (12:54 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
disk-utils/swaplabel.c

index bf4ee71c2d88576943d135ff92c4692092ec5690..44b1cb368e26a54739edd0e242a38a98758f6e6e 100644 (file)
@@ -68,8 +68,9 @@ static blkid_probe get_swap_prober(const char *devname)
 
        if (rc == 0) {
                /* supported is SWAPSPACE2 only */
-               blkid_probe_lookup_value(pr, "VERSION", &version, NULL);
-               if (strcmp(version, "2"))
+               if (blkid_probe_lookup_value(pr, "VERSION", &version, NULL) == 0
+                   && version
+                   && strcmp(version, "2"))
                        warnx(_("%s: unsupported swap version '%s'"),
                                                devname, version);
                else