[LTP] [PATCH] syscalls/statx05: add mkfs.ext4 package version check

Po-Hsu Lin po-hsu.lin@canonical.com
Mon Nov 2 03:43:01 CET 2020


On Fri, Oct 30, 2020 at 9:11 PM Cyril Hrubis <chrubis@suse.cz> wrote:
>
> Hi!
> > +     int ret, rc, major, minor, patch;
> > +
> > +     f = SAFE_POPEN("mkfs.ext4 -V 2>&1 | awk '/mke2fs/ {print $2}'", "r");
> > +     rc = fscanf(f, "%d.%d.%d", &major, &minor, &patch);
>
> I wonder if the awk is necessary, it may produce TWARN on minimal
> embedded systems where awk is not present. Why can't we use scanf() instead?
>
> As far as I can tell fscanf(f, "mke2fs %d.%d.%d", &major, &minor,
> &patch); should work fine without the awk.
Yes this works,
I will send V2 for this, thanks!

>
> --
> Cyril Hrubis
> chrubis@suse.cz


More information about the ltp mailing list