first-free-port : remaniement de la fonction is_valid_tcp_port
This commit is contained in:
parent
057ebd1b1a
commit
bf4dd08139
1 changed files with 2 additions and 3 deletions
|
@ -5,7 +5,6 @@
|
|||
#include <string.h>
|
||||
|
||||
#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[]) {
|
||||
|
|
Loading…
Reference in a new issue