[Toybox] [PATCH] blkid: more scanf fun.

enh enh at google.com
Sat Sep 25 13:04:32 PDT 2021


yeah, there are fairly-common fs types that toybox blkid currently doesn't
know too. ("LVM2_member" and "crypto_LUKS" for example.)

On Sat, Sep 25, 2021 at 9:41 AM Rob Landley <rob at landley.net> wrote:

> On 9/24/21 7:55 PM, enh via Toybox wrote:
> > The unbounded %[] here made me look at the kernel, where the size of a
> > block device name is limited to 32 bytes (including the NUL), so
> > although the 1024 bytes of toybuf was plenty, that meant that the
> > 32-byte buffer for "/dev/%s" was too small because the "%s" alone could
> > require the entire buffer. Fix that, and simplify the code a bit by only
> > using toybuf for the fgets(). I didn't switch to fscanf() because the
> > file has two lines of headers, and calling fgets() twice to skip the
> > header seemed more awkward than keeping the continue in the loop.
>
> I have a todo item to make "file" check the blkid types somehow. Haven't
> worked
> out a clean way to do it yet (plumbing logically moves to
> lib/getmountlist.c
> except that vanished), but I ran toybox "file" against a vfat image and it
> unknowned it, which disappointed me.
>
> Rob
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20210925/5662e1d0/attachment-0001.htm>


More information about the Toybox mailing list