From 3a256ec9bd62c3a1d053730c65a8945287e5a8e5 Mon Sep 17 00:00:00 2001 From: Nakidai Date: Tue, 6 Jan 2026 14:39:22 +0300 Subject: Use strtoul instead of strtod I really thought strtod was converting to integers... --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 8be182a..66b3f7a 100644 --- a/main.c +++ b/main.c @@ -37,8 +37,8 @@ main(int argc, char **argv) errx(1, "usage: %s hostname bindaddr port", argv[0]); hostname = argv[1]; host = argv[2]; - port = strtod(argv[3], &p); - if (*p || port <= 0 || port > 65535) + port = strtoul(argv[3], &p, 10); + if (*p || !port || port > 65535) errx(1, "invalid port"); #ifdef __OpenBSD__ -- cgit 1.4.1