aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-08-26 09:18:39 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-08-26 09:18:39 +0200
commit42237f52084d203dccddcb58b452d676fd8d70fe (patch)
tree732eaaafa9518ae06c343271702006419a5e9a27
parent8307642c8c0dab1dcfccb5f36b4e5e5e3f4f12be (diff)
Simplify errno checks
-rw-r--r--src/main.c3
1 files changed, 1 insertions, 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);