util: fix test for text_version
[thirdparty/mdadm.git] / util.c
diff --git a/util.c b/util.c
index 35bb91b..dddcc8b 100644 (file)
--- a/util.c
+++ b/util.c
@@ -916,7 +916,10 @@ struct supertype *super_by_fd(int fd)
                if (sra)
                        sysfs_free(sra);
                sra = sysfs_read(-1, devnum, GET_VERSION);
-               verstr = sra->text_version ? : "-no-metadata-";
+               if (sra && sra->text_version[0])
+                       verstr = sra->text_version;
+               else
+                       verstr = "-no-metadata-";
        }
 
        for (i = 0; st == NULL && superlist[i] ; i++)