Add handler to catch errors on conversion of numerical arguments. Signed-off-by: Hartmut Knaack <knaack.h@xxxxxx> --- tools/iio/generic_buffer.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c index 9164b27..934b4c9 100644 --- a/tools/iio/generic_buffer.c +++ b/tools/iio/generic_buffer.c @@ -206,13 +206,22 @@ int main(int argc, char **argv) noevents = 1; break; case 'c': + errno = 0; num_loops = strtoul(optarg, &dummy, 10); + if (errno) + return -errno; break; case 'w': + errno = 0; timedelay = strtoul(optarg, &dummy, 10); + if (errno) + return -errno; break; case 'l': + errno = 0; buf_len = strtoul(optarg, &dummy, 10); + if (errno) + return -errno; break; case 'g': notrigger = 1; -- 2.3.6 -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html