util: fix test for text_version
authorNeilBrown <neilb@suse.de>
Mon, 11 May 2009 05:21:43 +0000 (15:21 +1000)
committerNeilBrown <neilb@suse.de>
Mon, 11 May 2009 05:21:43 +0000 (15:21 +1000)
as text_version is a char array (not a pointer), testing the
address against NULL is the wrong thing to do.  Test the
content instead.

Signed-off-by: NeilBrown <neilb@suse.de>
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++)