~/paste/44995
~/paste/44995
~/paste/44995

  1. From 62886af06cee345948dbb849577c7aed63033106 Mon Sep 17 00:00:00 2001
  2. From: Mirko Vogt <mirko-openwrt@nanl.de>
  3. Date: Sun, 26 Apr 2020 01:47:50 +0200
  4. Subject: [PATCH] Truncate FAT filesystem label until 1st occurance of a blank
  5.  (0x20)
  6.  
  7. According to spec the FAT filesystem label is not terminated by a
  8. \0-byte but instead has a fixed length where the name is padded by
  9. blanks.
  10. Before libblkid-tiny just passed the always 11 bytes long blank padded
  11. string through, however it makes matching for a filesystem label
  12. inconsistent with other filesystems, which use a \0-terminated string.
  13.  
  14. Before: "foobar     "
  15. After : "foobar"
  16.  
  17. Signed-off-by: Mirko Vogt <mirko-openwrt@nanl.de>
  18. ---
  19. libblkid-tiny/vfat.c | 6 ++++--
  20.  1 file changed, 4 insertions(+), 2 deletions(-)
  21.  
  22. diff --git a/libblkid-tiny/vfat.c b/libblkid-tiny/vfat.c
  23. index e70dd75..1bce002 100644
  24. --- a/libblkid-tiny/vfat.c
  25. +++ b/libblkid-tiny/vfat.c
  26. @@ -422,8 +422,10 @@ static int probe_vfat(blkid_probe pr, const struct blkid_idmag *mag)
  27.         if (boot_label && memcmp(boot_label, no_name, 11))
  28.                 blkid_probe_set_id_label(pr, "LABEL_FATBOOT", (unsigned char *) boot_label, 11);
  29.  
  30. -       if (vol_label)
  31. -               blkid_probe_set_label(pr, (unsigned char *) vol_label, 11);
  32. +       if (vol_label) {
  33. +                strtok((char *) vol_label, " ");
  34. +                blkid_probe_set_label(pr, (unsigned char *) vol_label, 11);
  35. +        }
  36.  
  37.         /* We can't just print them as %04X, because they are unaligned */
  38.         if (vol_serno)
  39. --
  40. 2.26.2
Language: diff
Posted by Anonymous at 26 Apr 2020, 12:03:01 UTC