diff options
-rw-r--r-- | proxy-proto.c | 12 | ||||
-rw-r--r-- | server.c | 8 |
2 files changed, 10 insertions, 10 deletions
diff --git a/proxy-proto.c b/proxy-proto.c index 4ad13f3..330eec6 100644 --- a/proxy-proto.c +++ b/proxy-proto.c @@ -26,7 +26,7 @@ check_prefix_v1(char **buf) { static const char PROXY[6] = "PROXY "; - if (0 != strncmp(*buf, PROXY, sizeof(PROXY))) + if (strncmp(*buf, PROXY, sizeof(PROXY)) != 0) return PROXY_PROTO_PARSE_FAIL; *buf += sizeof(PROXY); @@ -39,7 +39,7 @@ check_proto_v1(char **buf) { static const char TCP[3] = "TCP"; - if (0 != strncmp(*buf, TCP, sizeof(TCP))) + if (strncmp(*buf, TCP, sizeof(TCP)) != 0) return PROXY_PROTO_PARSE_FAIL; *buf += sizeof(TCP); @@ -62,7 +62,7 @@ check_unknown_v1(char **buf) { static const char UNKNOWN[7] = "UNKNOWN"; - if (0 != strncmp(*buf, UNKNOWN, sizeof(UNKNOWN))) + if (strncmp(*buf, UNKNOWN, sizeof(UNKNOWN)) != 0) return PROXY_PROTO_PARSE_FAIL; *buf += sizeof(UNKNOWN); @@ -89,12 +89,12 @@ check_ip_v1(int af, void *addr, char **buf) { char *spc; - if (NULL == (spc = strchr(*buf, ' '))) + if ((spc = strchr(*buf, ' ')) == NULL) return PROXY_PROTO_PARSE_FAIL; *spc++ = '\0'; - if (1 != inet_pton(af, *buf, addr)) + if (inet_pton(af, *buf, addr) != 1) return PROXY_PROTO_PARSE_FAIL; *buf = spc; @@ -108,7 +108,7 @@ check_port_v1(uint16_t *port, char **buf, size_t *buflen) size_t wspc_idx = strcspn(*buf, " \r"); char *wspc = *buf + wspc_idx; - if (!(' ' == *wspc || '\r' == *wspc)) + if (!(*wspc == ' ' || *wspc == '\r')) return PROXY_PROTO_PARSE_FAIL; *wspc++ = '\0'; @@ -1304,7 +1304,7 @@ read_cb(struct tls *ctx, void *buf, size_t buflen, void *cb_arg) // no buffer to cache into, read into libtls buffer errno = 0; ssize_t ret = read(c->fd, buf, buflen); - if (-1 == ret && errno == EWOULDBLOCK) + if (ret == -1 && errno == EWOULDBLOCK) ret = TLS_WANT_POLLIN; return ret; @@ -1333,7 +1333,7 @@ read_cb(struct tls *ctx, void *buf, size_t buflen, void *cb_arg) c->buf.data + c->buf.len, BUFLAYER_MAX - c->buf.len ); - if (-1 == n_read && errno == EWOULDBLOCK) + if (n_read == -1 && errno == EWOULDBLOCK) return TLS_WANT_POLLIN; c->buf.len += n_read; @@ -1361,7 +1361,7 @@ read_cb(struct tls *ctx, void *buf, size_t buflen, void *cb_arg) break; } - if (PROTO_UNKNOWN != pp1.proto) { + if (pp1.proto != PROTO_UNKNOWN) { snprintf(c->rserv, sizeof(c->rserv), "%u", pp1.srcport); } @@ -1387,7 +1387,7 @@ static ssize_t write_cb(struct tls *ctx, const void *buf, size_t buflen, void *c struct client *c = cb_arg; ssize_t ret = write(c->fd, buf, buflen); - if (-1 == ret && EAGAIN == errno) + if (ret == -1 && errno == EAGAIN) return TLS_WANT_POLLOUT; return ret; |