summaryrefslogtreecommitdiffstats
path: root/tools/iio/generic_buffer.c
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 20:22:57 +0200
commitc8ce9903cba202936999c2c9463fbb370ee145ba (patch)
treefec16789a067e4358e32c1344dae3ea6d4a81d48 /tools/iio/generic_buffer.c
parenttools:iio: catch errors in string allocation (diff)
downloadlinux-c8ce9903cba202936999c2c9463fbb370ee145ba.tar.xz
linux-c8ce9903cba202936999c2c9463fbb370ee145ba.zip
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 '')
-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;