Skip to content

Commit

Permalink
core: fix compilation warnings
Browse files Browse the repository at this point in the history
> core/tcp_main.c:1135:13: warning: result of comparison of constant 18446744073709551615 with expression of type 'uint32_t' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
>                        if (port == ULONG_MAX || port == 0 || port >= (1 << 16)) {
>                            ~~~~ ^  ~~~~~~~~~
> core/tcp_main.c:1147:13: warning: result of comparison of constant 18446744073709551615 with expression of type 'uint32_t' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
>                        if (port == ULONG_MAX || port == 0 || port >= (1 << 16)) {
>                            ~~~~ ^  ~~~~~~~~~
> 2 warnings generated.
  • Loading branch information
linuxmaniac committed Dec 19, 2018
1 parent 89e89e0 commit d8f595f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/tcp_main.c
Expand Up @@ -1132,7 +1132,7 @@ int tcpconn_read_haproxy(struct tcp_connection *c) {

/* Parse the source port */
port = strtoul(p, &end, 10);
if (port == ULONG_MAX || port == 0 || port >= (1 << 16)) {
if (port == UINT32_MAX || port == 0 || port >= (1 << 16)) {
return -1; /* invalid port number */
}
c->rcv.src_port = port;
Expand All @@ -1144,7 +1144,7 @@ int tcpconn_read_haproxy(struct tcp_connection *c) {

/* Parse the destination port */
port = strtoul(p, NULL, 10);
if (port == ULONG_MAX || port == 0 || port >= (1 << 16)) {
if (port == UINT32_MAX || port == 0 || port >= (1 << 16)) {
return -1; /* invalid port number */
}
c->rcv.dst_port = port;
Expand Down

0 comments on commit d8f595f

Please sign in to comment.