X-Git-Url: http://git.archive.openwrt.org/?p=project%2Ffstools.git;a=blobdiff_plain;f=libblkid-tiny%2Fvfat.c;fp=libblkid-tiny%2Fvfat.c;h=49b865adf0bce98923f929fa00364f6f93d85426;hp=9f3d39551e016dffd14289c136c5469d8f715459;hb=3d239815bb048041ec0d48cba273573d148ad7a9;hpb=c4a3c9785e9e554f5b89dd95c3071bd4f30cbdbc diff --git a/libblkid-tiny/vfat.c b/libblkid-tiny/vfat.c index 9f3d395..49b865a 100644 --- a/libblkid-tiny/vfat.c +++ b/libblkid-tiny/vfat.c @@ -302,11 +302,12 @@ static int probe_vfat(blkid_probe pr, const struct blkid_idmag *mag) { struct vfat_super_block *vs; struct msdos_super_block *ms; - const unsigned char *vol_label = 0; + unsigned char *vol_label = 0; unsigned char *vol_serno = NULL, vol_label_buf[12] = { 0 }; uint16_t sector_size = 0, reserved; uint32_t cluster_count, fat_size; const char *version = NULL; + int i; ms = blkid_probe_get_sb(pr, mag, struct msdos_super_block); if (!ms) @@ -418,6 +419,12 @@ static int probe_vfat(blkid_probe pr, const struct blkid_idmag *mag) } } + for (i = 10; i >= 0; i--) { + if (vol_label[i] != ' ') + break; + vol_label[i] = '\0'; + } + if (vol_label && memcmp(vol_label, no_name, 11)) blkid_probe_set_label(pr, (unsigned char *) vol_label, 11);