From: Simon Ruderich Date: Mon, 7 Mar 2011 05:52:41 +0000 (+0100) Subject: src/*.c: Always use constants on the left in comparisons. X-Git-Tag: 0.1~30 X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=7482f10d37782bbca56237357323521f2d87ea54;p=tlsproxy%2Ftlsproxy.git src/*.c: Always use constants on the left in comparisons. --- diff --git a/src/connection.c b/src/connection.c index 4160c7f..a42fbe0 100644 --- a/src/connection.c +++ b/src/connection.c @@ -71,10 +71,10 @@ void handle_connection(int client_socket) { /* Read request line (CONNECT ..) and headers (they are discarded). */ result = read_http_request(client_fd, buffer, sizeof(buffer)); - if (result == -1) { + if (-1 == result) { /* Read error. */ return; - } else if (result == -2) { + } else if (-2 == result) { /* EOF */ send_close_bad_request(client_fd); return; @@ -120,11 +120,11 @@ void handle_connection(int client_socket) { /* Read response line from proxy server. */ result = read_http_request(server_fd, buffer, sizeof(buffer)); - if (result == -1) { + if (-1 == result) { /* Read error. */ send_close_forwarding_failure(client_fd); return; - } else if (result == -2) { + } else if (-2 == result) { /* EOF */ fclose(server_fd); send_close_forwarding_failure(client_fd); diff --git a/src/tlsproxy.c b/src/tlsproxy.c index 9c3b53c..7c70133 100644 --- a/src/tlsproxy.c +++ b/src/tlsproxy.c @@ -291,7 +291,7 @@ static void worker_thread(void) { V(ringbuffer_free); /* Negative value indicates we should shut down our thread. */ - if (client_socket < 0) { + if (0 > client_socket) { break; }