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

Cyril Hrubis chrubis@suse.cz
Fri Oct 30 14:12:14 CET 2020


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.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list