From 3fe2ebf8e4127bca0a57d4ed8eb6035792420a26 Mon Sep 17 00:00:00 2001 From: Misaki Shioi <31817032+shioimm@users.noreply.github.com> Date: Sun, 28 Dec 2025 17:23:50 +0900 Subject: [PATCH] Remove unnecessary comparison from is_local_port_fixed (#15757) Simplify the conditions: - Return false if the port is 0 or a negative number - Return true if the port is a positive number --- ext/socket/ipsocket.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ext/socket/ipsocket.c b/ext/socket/ipsocket.c index 758d37293ffc2c..931a1a629c87f6 100644 --- a/ext/socket/ipsocket.c +++ b/ext/socket/ipsocket.c @@ -269,9 +269,8 @@ is_local_port_fixed(const char *portp) if (endp == portp) return 0; if (errno == ERANGE) return 0; - if (port <= 0) return 0; - return port != 0; + return port > 0; } struct fast_fallback_inetsock_arg