block: discard vfat labels with only spaces
authorJo-Philipp Wich <jow@openwrt.org>
Thu, 25 Jul 2013 12:23:07 +0000 (14:23 +0200)
committerJo-Philipp Wich <jow@openwrt.org>
Thu, 25 Jul 2013 12:23:07 +0000 (14:23 +0200)
libblkid-tiny/vfat.c

index dd53d6856cd3b4c5c24a71fc267028a269fc178a..ef66769a09b6d25d153032abc11c03acba741c27 100644 (file)
@@ -277,9 +277,12 @@ static int set_label(blkid_probe pr, unsigned char *vol_label)
 {
        unsigned char *c;
 
-       for (c = vol_label + 10; c > vol_label && *c == ' '; c--)
+       for (c = vol_label + 10; c >= vol_label && *c == ' '; c--)
                *c = 0;
 
+       if (!*vol_label)
+               return 0;
+
        return blkid_probe_set_label(pr, vol_label, 11);
 }