summaryrefslogtreecommitdiffstats
path: root/plugins/netutils.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/netutils.c')
-rw-r--r--plugins/netutils.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/plugins/netutils.c b/plugins/netutils.c
index e2916c65..92c53e4c 100644
--- a/plugins/netutils.c
+++ b/plugins/netutils.c
@@ -63,7 +63,8 @@ void socket_timeout_alarm_handler(int sig) {
63/* connects to a host on a specified tcp port, sends a string, and gets a 63/* connects to a host on a specified tcp port, sends a string, and gets a
64 response. loops on select-recv until timeout or eof to get all of a 64 response. loops on select-recv until timeout or eof to get all of a
65 multi-packet answer */ 65 multi-packet answer */
66int process_tcp_request2(const char *server_address, int server_port, const char *send_buffer, char *recv_buffer, int recv_size) { 66int process_tcp_request2(const char *server_address, int server_port, const char *send_buffer,
67 char *recv_buffer, int recv_size) {
67 68
68 int result; 69 int result;
69 int send_result; 70 int send_result;
@@ -104,7 +105,8 @@ int process_tcp_request2(const char *server_address, int server_port, const char
104 } 105 }
105 break; 106 break;
106 } else { /* it has */ 107 } else { /* it has */
107 recv_result = recv(sd, recv_buffer + recv_length, (size_t)recv_size - recv_length - 1, 0); 108 recv_result =
109 recv(sd, recv_buffer + recv_length, (size_t)recv_size - recv_length - 1, 0);
108 if (recv_result == -1) { 110 if (recv_result == -1) {
109 /* recv failed, bail out */ 111 /* recv failed, bail out */
110 strcpy(recv_buffer + recv_length, ""); 112 strcpy(recv_buffer + recv_length, "");
@@ -133,7 +135,8 @@ int process_tcp_request2(const char *server_address, int server_port, const char
133 135
134/* connects to a host on a specified port, sends a string, and gets a 136/* connects to a host on a specified port, sends a string, and gets a
135 response */ 137 response */
136int process_request(const char *server_address, int server_port, int proto, const char *send_buffer, char *recv_buffer, int recv_size) { 138int process_request(const char *server_address, int server_port, int proto, const char *send_buffer,
139 char *recv_buffer, int recv_size) {
137 int result; 140 int result;
138 int sd; 141 int sd;
139 142
@@ -253,7 +256,8 @@ int np_net_connect(const char *host_name, int port, int *sd, int proto) {
253 if (is_socket) { 256 if (is_socket) {
254 // printf("connect to file socket %s: %s\n", host_name, strerror(errno)); 257 // printf("connect to file socket %s: %s\n", host_name, strerror(errno));
255 } else { 258 } else {
256 // printf("connect to address %s and port %d: %s\n", host_name, port, strerror(errno)); 259 // printf("connect to address %s and port %d: %s\n", host_name, port,
260 // strerror(errno));
257 } 261 }
258 return STATE_CRITICAL; 262 return STATE_CRITICAL;
259 break; 263 break;