提交 dc8b5d6e 编写于 作者: H Hartmut Knaack 提交者: Jonathan Cameron

tools:iio:iio_utils: check amount of matches

fscanf() usually returns the number of input items successfully matched
and assigned, which can be fewer than provided (or even zero).
Add a check in iioutils_get_type() to make sure all items are matched.
Signed-off-by: NHartmut Knaack <knaack.h@gmx.de>
Signed-off-by: NJonathan Cameron <jic23@kernel.org>
上级 8e926134
......@@ -144,6 +144,10 @@ int iioutils_get_type(unsigned *is_signed,
ret = -errno;
printf("failed to pass scan type description\n");
goto error_close_sysfsfp;
} else if (ret != 5) {
ret = -EIO;
printf("scan type description didn't match\n");
goto error_close_sysfsfp;
}
*be = (endianchar == 'b');
*bytes = padint / 8;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册