Commit c8ce9903 authored by Hartmut Knaack's avatar Hartmut Knaack Committed by Jonathan Cameron

tools:iio:generic_buffer: catch errors for arguments conversion

Add handler to catch errors on conversion of numerical arguments.
Signed-off-by: default avatarHartmut Knaack <knaack.h@gmx.de>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent e9e45b43
...@@ -206,13 +206,22 @@ int main(int argc, char **argv) ...@@ -206,13 +206,22 @@ int main(int argc, char **argv)
noevents = 1; noevents = 1;
break; break;
case 'c': case 'c':
errno = 0;
num_loops = strtoul(optarg, &dummy, 10); num_loops = strtoul(optarg, &dummy, 10);
if (errno)
return -errno;
break; break;
case 'w': case 'w':
errno = 0;
timedelay = strtoul(optarg, &dummy, 10); timedelay = strtoul(optarg, &dummy, 10);
if (errno)
return -errno;
break; break;
case 'l': case 'l':
errno = 0;
buf_len = strtoul(optarg, &dummy, 10); buf_len = strtoul(optarg, &dummy, 10);
if (errno)
return -errno;
break; break;
case 'g': case 'g':
notrigger = 1; notrigger = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment