From bf4dd08139207d433cc5fec8a62aa24566777a52 Mon Sep 17 00:00:00 2001 From: Hippolyte Chauvin Date: Sat, 2 Dec 2023 00:11:42 +0100 Subject: [PATCH] first-free-port : remaniement de la fonction is_valid_tcp_port --- src/first-free-port.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/first-free-port.c b/src/first-free-port.c index 1789e85..c823684 100644 --- a/src/first-free-port.c +++ b/src/first-free-port.c @@ -5,7 +5,6 @@ #include #define MIN_TCP_PORT 1 -#define MAX_TCP_PORT 65534 #define TCP_TABLE "/proc/net/tcp" #define TCP_TABLE_LINE_LENGTH 151 #define LOCALHOST_HEX "0100007F" @@ -68,8 +67,8 @@ static unsigned char is_port_available(const unsigned short port, const unsigned return listening_ports[i] == 0; } -static unsigned char is_valid_tcp_port(unsigned short tcp_port) { - return tcp_port >= MIN_TCP_PORT && tcp_port <= MAX_TCP_PORT; +static inline unsigned char is_valid_tcp_port(const unsigned short tcp_port) { + return tcp_port >= MIN_TCP_PORT; } int main(int argc, char *argv[]) {