From 42237f52084d203dccddcb58b452d676fd8d70fe Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Mon, 26 Aug 2024 09:18:39 +0200 Subject: Simplify errno checks --- src/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 83c27ef..3e61b29 100644 --- a/src/main.c +++ b/src/main.c @@ -64,7 +64,6 @@ main(int argc, char **argv) if (!xisdigit(optarg[0])) errx(1, "%s: Invalid integer", optarg); - errno = 0; char *endptr; long n = strtol(optarg, &endptr, 10); @@ -77,8 +76,8 @@ main(int argc, char **argv) LONG_MIN. */ if (n > INT_MAX) errno = ERANGE; - if (errno == ERANGE) err(1, "%s", optarg); + } if (n == 0) errx(1, "%s: Integer must be non-zero", optarg); -- cgit v1.2.3