--- projects/cms/source/ihost/ihost.c 2003/03/10 08:18:17 1.36 +++ projects/cms/source/ihost/ihost.c 2003/03/29 18:49:49 1.39 @@ -32,8 +32,8 @@ #include #include -#include "ukcprog.h" -#include "statgrab.h" +#include +#include #define LOG_CRIT 0 #define LOG_ERR 1 @@ -163,6 +163,7 @@ void log_msg(int level, char *format, ...){ }else{ fprintf(ihost_config.log, "\n"); } + fflush(ihost_config.log); } } @@ -222,6 +223,7 @@ FILE *create_tcp_connection(char *hostname, int port){ if((get_host_addr(hostname, &haddr))!=0){ log_msg(LOG_CRIT, "Failed to lookup name for %s", hostname); + close(sock); return NULL; } @@ -233,6 +235,7 @@ FILE *create_tcp_connection(char *hostname, int port){ log_msg(LOG_DEBUG, "Creating a tcp connection"); if(connect(sock, (struct sockaddr *)&addr, sizeof(addr)) !=0){ log_msg(LOG_CRIT, "Failed to connect to hostname %s on port %d", hostname, port); + close(sock); return NULL; }