32 |
|
#include <errno.h> |
33 |
|
#include <netdb.h> |
34 |
|
|
35 |
< |
#include "ukcprog.h" |
36 |
< |
#include "statgrab.h" |
35 |
> |
#include <ukcprog.h> |
36 |
> |
#include <statgrab.h> |
37 |
|
|
38 |
|
#define LOG_CRIT 0 |
39 |
|
#define LOG_ERR 1 |
163 |
|
}else{ |
164 |
|
fprintf(ihost_config.log, "\n"); |
165 |
|
} |
166 |
+ |
fflush(ihost_config.log); |
167 |
|
} |
168 |
|
} |
169 |
|
|
223 |
|
|
224 |
|
if((get_host_addr(hostname, &haddr))!=0){ |
225 |
|
log_msg(LOG_CRIT, "Failed to lookup name for %s", hostname); |
226 |
+ |
close(sock); |
227 |
|
return NULL; |
228 |
|
} |
229 |
|
|
235 |
|
log_msg(LOG_DEBUG, "Creating a tcp connection"); |
236 |
|
if(connect(sock, (struct sockaddr *)&addr, sizeof(addr)) !=0){ |
237 |
|
log_msg(LOG_CRIT, "Failed to connect to hostname %s on port %d", hostname, port); |
238 |
+ |
close(sock); |
239 |
|
return NULL; |
240 |
|
} |
241 |
|
|