X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fubox.git;a=blobdiff_plain;f=libblkid-tiny%2Fvfat.c;h=dd53d6856cd3b4c5c24a71fc267028a269fc178a;hp=a24e6c354389e24506ec928f1f11ede4e7e4b05a;hb=9f7073df932cfb5037df05c6a3bb0b6cd3ee076c;hpb=0ce8e1b704b22d218d98524addcb59f466544fda;ds=sidebyside diff --git a/libblkid-tiny/vfat.c b/libblkid-tiny/vfat.c index a24e6c3..dd53d68 100644 --- a/libblkid-tiny/vfat.c +++ b/libblkid-tiny/vfat.c @@ -273,6 +273,16 @@ static int fat_valid_superblock(const struct blkid_idmag *mag, static struct vfat_super_block vs; static struct msdos_super_block ms; +static int set_label(blkid_probe pr, unsigned char *vol_label) +{ + unsigned char *c; + + for (c = vol_label + 10; c > vol_label && *c == ' '; c--) + *c = 0; + + return blkid_probe_set_label(pr, vol_label, 11); +} + /* FAT label extraction from the root directory taken from Kay * Sievers's volume_id library */ static int probe_vfat(blkid_probe pr, const struct blkid_idmag *mag) @@ -396,7 +406,7 @@ static int probe_vfat(blkid_probe pr, const struct blkid_idmag *mag) } if (vol_label && memcmp(vol_label, no_name, 11)) - blkid_probe_set_label(pr, (unsigned char *) vol_label, 11); + set_label(pr, (unsigned char *) vol_label); /* We can't just print them as %04X, because they are unaligned */ if (vol_serno)