summaryrefslogtreecommitdiffstats
path: root/disk-utils/swaplabel.c
diff options
context:
space:
mode:
Diffstat (limited to 'disk-utils/swaplabel.c')
-rw-r--r--disk-utils/swaplabel.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/disk-utils/swaplabel.c b/disk-utils/swaplabel.c
index bf4ee71c2..44b1cb368 100644
--- a/disk-utils/swaplabel.c
+++ b/disk-utils/swaplabel.c
@@ -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