summaryrefslogtreecommitdiffstats
path: root/libblkid
diff options
context:
space:
mode:
authorKarel Zak2018-03-27 12:54:53 +0200
committerKarel Zak2018-03-27 12:54:53 +0200
commit04060bc3f12b8b37799474cac93deb9d47258e7b (patch)
treec1aaa78ae2e01bb71291c72e067d291c99f6966b /libblkid
parenttests: update column(1) space-separator test (diff)
parenttests: Add tests for FAT32 labels (diff)
downloadkernel-qcow2-util-linux-04060bc3f12b8b37799474cac93deb9d47258e7b.tar.gz
kernel-qcow2-util-linux-04060bc3f12b8b37799474cac93deb9d47258e7b.tar.xz
kernel-qcow2-util-linux-04060bc3f12b8b37799474cac93deb9d47258e7b.zip
Merge branch 'master' of https://github.com/pali/util-linux
* 'master' of https://github.com/pali/util-linux: tests: Add tests for FAT32 labels blkid: Encode any field which starts with LABEL in same way as LABEL field libblkid: vfat: Change parsing label in special cases
Diffstat (limited to 'libblkid')
-rw-r--r--libblkid/src/superblocks/vfat.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libblkid/src/superblocks/vfat.c b/libblkid/src/superblocks/vfat.c
index 3aeba018a..df4ebe371 100644
--- a/libblkid/src/superblocks/vfat.c
+++ b/libblkid/src/superblocks/vfat.c
@@ -308,6 +308,7 @@ 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 = NULL;
+ const unsigned char *boot_label = NULL;
unsigned char *vol_serno = NULL, vol_label_buf[11];
uint16_t sector_size = 0, reserved;
uint32_t cluster_count, fat_size;
@@ -338,8 +339,7 @@ static int probe_vfat(blkid_probe pr, const struct blkid_idmag *mag)
vol_label = vol_label_buf;
}
- if (!vol_label || !memcmp(vol_label, no_name, 11))
- vol_label = ms->ms_label;
+ boot_label = ms->ms_label;
vol_serno = ms->ms_serno;
blkid_probe_set_value(pr, "SEC_TYPE", (unsigned char *) "msdos",
@@ -393,8 +393,7 @@ static int probe_vfat(blkid_probe pr, const struct blkid_idmag *mag)
version = "FAT32";
- if (!vol_label || !memcmp(vol_label, no_name, 11))
- vol_label = vs->vs_label;
+ boot_label = vs->vs_label;
vol_serno = vs->vs_serno;
/*
@@ -423,7 +422,10 @@ static int probe_vfat(blkid_probe pr, const struct blkid_idmag *mag)
}
}
- if (vol_label && memcmp(vol_label, no_name, 11))
+ if (boot_label && memcmp(boot_label, no_name, 11))
+ blkid_probe_set_id_label(pr, "LABEL_FATBOOT", (unsigned char *) boot_label, 11);
+
+ if (vol_label)
blkid_probe_set_label(pr, (unsigned char *) vol_label, 11);
/* We can't just print them as %04X, because they are unaligned */