summaryrefslogtreecommitdiff
path: root/tools/iio
diff options
context:
space:
mode:
authorHartmut Knaack <knaack.h@gmx.de>2015-05-31 14:40:03 +0200
committerJonathan Cameron <jic23@kernel.org>2015-05-31 19:22:57 +0100
commitc8ce9903cba202936999c2c9463fbb370ee145ba (patch)
treefec16789a067e4358e32c1344dae3ea6d4a81d48 /tools/iio
parente9e45b43b8f06273d9b78f187042dff0bf5be0a5 (diff)
tools:iio:generic_buffer: catch errors for arguments conversion
Add handler to catch errors on conversion of numerical arguments. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'tools/iio')
-rw-r--r--tools/iio/generic_buffer.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c
index eb89bc2ca5d0..93ac93f74549 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;