--- projects/cms/source/ihost/ihost.c 2003/03/10 08:18:17 1.36 +++ projects/cms/source/ihost/ihost.c 2003/04/06 12:08:37 1.40 @@ -31,9 +31,10 @@ #include #include #include +#include -#include "ukcprog.h" -#include "statgrab.h" +#include +#include #define LOG_CRIT 0 #define LOG_ERR 1 @@ -163,6 +164,7 @@ void log_msg(int level, char *format, ...){ }else{ fprintf(ihost_config.log, "\n"); } + fflush(ihost_config.log); } } @@ -222,6 +224,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 +236,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; }