gpiomon: don't ignore superfluous arguments
authorBartosz Golaszewski <bartekgola@gmail.com>
Wed, 14 Jun 2017 10:53:19 +0000 (12:53 +0200)
committerBartosz Golaszewski <bartekgola@gmail.com>
Wed, 14 Jun 2017 10:53:19 +0000 (12:53 +0200)
We don't currently support watching more than one line at a time. Bail
out if the user gives us more than two non-option arguments.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
src/tools/gpiomon.c

index afc511b98aed306ada55d182f5a28f78618bf61b..6b984b985eca360d0872ba15cdc546e97fd54c5e 100644 (file)
@@ -158,6 +158,9 @@ int main(int argc, char **argv)
        if (argc < 2)
                die("GPIO line offset must be specified");
 
+       if (argc > 2)
+               die("watching more than one GPIO line unsupported");
+
        device = argv[0];
        offset = strtoul(argv[1], &end, 10);
        if (*end != '\0' || offset > INT_MAX)