summaryrefslogtreecommitdiffstats
path: root/tests/tcp_proxy/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tcp_proxy/main.c')
-rw-r--r--tests/tcp_proxy/main.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/tests/tcp_proxy/main.c b/tests/tcp_proxy/main.c
index 2d283ed9..5ea53f5f 100644
--- a/tests/tcp_proxy/main.c
+++ b/tests/tcp_proxy/main.c
@@ -26,7 +26,7 @@
#include <errno.h>
#include <locale.h>
#include <netdb.h>
-#include <sys/types.h>
+#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -109,7 +109,7 @@ g_hexdump(char *p, int len)
g_printf("%c", (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.');
}
- g_writeln("");
+ g_writeln("%s", "");
offset += thisline;
line += thisline;
}
@@ -121,7 +121,7 @@ g_tcp_socket(void)
{
int rv;
int option_value;
- unsigned int option_len;
+ socklen_t option_len;
rv = (int)socket(AF_INET, SOCK_STREAM, 0);
if (rv < 0)
@@ -336,9 +336,7 @@ static int APP_CC
g_tcp_socket_ok(int sck)
{
int opt;
- unsigned int opt_len;
-
- opt_len = sizeof(opt);
+ socklen_t opt_len = sizeof(opt);
if (getsockopt(sck, SOL_SOCKET, SO_ERROR, (char *)(&opt), &opt_len) == 0)
{
@@ -399,13 +397,6 @@ g_signal_user_interrupt(void (*func)(int))
/*****************************************************************************/
static void APP_CC
-g_signal_kill(void (*func)(int))
-{
- signal(SIGKILL, func);
-}
-
-/*****************************************************************************/
-static void APP_CC
g_signal_terminate(void (*func)(int))
{
signal(SIGTERM, func);
@@ -454,7 +445,7 @@ main_loop(char *local_port, char *remote_ip, char *remote_port, int hexdump)
g_writeln("bind failed");
}
- /* listen for an incomming connection */
+ /* listen for an incoming connection */
if (error == 0)
{
error = g_tcp_listen(lis_sck);
@@ -465,7 +456,7 @@ main_loop(char *local_port, char *remote_ip, char *remote_port, int hexdump)
}
}
- /* accept an incomming connection */
+ /* accept an incoming connection */
if (error == 0)
{
while ((!g_terminated) && (error == 0))
@@ -523,7 +514,7 @@ main_loop(char *local_port, char *remote_ip, char *remote_port, int hexdump)
if (i > 99)
{
- g_writeln("timout connecting");
+ g_writeln("timeout connecting");
error = 1;
}
@@ -685,7 +676,6 @@ main(int argc, char **argv)
g_init("tcp_proxy");
g_signal_user_interrupt(proxy_shutdown); /* SIGINT */
- g_signal_kill(proxy_shutdown); /* SIGKILL */
g_signal_usr1(clear_counters); /* SIGUSR1 */
g_signal_terminate(proxy_shutdown); /* SIGTERM */