summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/devices/grolbp/lbp.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/devices/grolbp/lbp.cpp b/src/devices/grolbp/lbp.cpp
index c05b42ec3..c28f2e672 100644
--- a/src/devices/grolbp/lbp.cpp
+++ b/src/devices/grolbp/lbp.cpp
@@ -707,10 +707,11 @@ int main(int argc, char **argv)
case 'w':
{
char *ptr;
+ errno = 0;
long n = strtol(optarg, &ptr, 10);
if (ptr == optarg)
error("argument for -w must be a non-negative integer");
- else if (n < 0 || n > INT_MAX)
+ else if (errno == ERANGE || n < 0 || n > INT_MAX)
error("out of range argument for -w");
else
linewidth_factor = int(n);