| 32 |
|
#include <errno.h> |
| 33 |
|
#include <netdb.h> |
| 34 |
|
|
| 35 |
< |
#include <ukcprog.h> |
| 35 |
> |
#include "ukcprog.h" |
| 36 |
|
#include "statgrab.h" |
| 37 |
|
|
| 38 |
|
#define LOG_CRIT 0 |
| 40 |
|
#define LOG_INFO 2 |
| 41 |
|
#define LOG_DEBUG 3 |
| 42 |
|
|
| 43 |
– |
#define PID_FILE "/var/run/ihost.pid" |
| 44 |
– |
#define LOGFILE_PATH "/var/log/ihost.log" |
| 45 |
– |
#define VERSION ".03" |
| 46 |
– |
|
| 47 |
– |
#define MAX_UDP_PACKET_SIZE 8192 |
| 48 |
– |
|
| 43 |
|
typedef struct{ |
| 44 |
|
int filtermanager_port; |
| 45 |
|
char *filtermanager_host; |
| 220 |
|
int server_udp_port=0; |
| 221 |
|
time_t config_ttl=0; |
| 222 |
|
|
| 223 |
< |
tcp_con=create_tcp_connection(ihost_state->filtermanager_host, ihost_state->filtermanager_port); |
| 223 |
> |
if((tcp_con=create_tcp_connection(ihost_state->filtermanager_host, ihost_state->filtermanager_port))==NULL){ |
| 224 |
> |
goto error; |
| 225 |
> |
} |
| 226 |
|
|
| 227 |
|
if(ihost_state->file_list!=NULL || ihost_state->last_modified!=NULL){ |
| 228 |
|
if(tcp_con==NULL){ |
| 238 |
|
} |
| 239 |
|
|
| 240 |
|
if((tcp_comm(tcp_con, ihost_state->last_modified, &response, "OK"))==0){ |
| 241 |
< |
if((tcp_comm(tcp_con, "END", &response, "OK"))==0){ |
| 241 |
> |
if((tcp_comm(tcp_con, "END", &response, "OK"))!=0){ |
| 242 |
|
goto error; |
| 243 |
|
} |
| 244 |
|
fclose(tcp_con); |
| 678 |
|
break; |
| 679 |
|
|
| 680 |
|
case 'V': |
| 681 |
< |
fprintf(stderr, "%s version %s", argv[0], VERSION); |
| 681 |
> |
fprintf(stderr, "%s version %s\n", argv[0], VERSION); |
| 682 |
|
break; |
| 683 |
|
|
| 684 |
|
default: |
| 719 |
|
exit(1); |
| 720 |
|
} |
| 721 |
|
|
| 722 |
< |
if((ihost_config.log=fopen(LOGFILE_PATH, "a"))==NULL){ |
| 722 |
> |
if((ihost_config.log=fopen(LOG_FILE, "a"))==NULL){ |
| 723 |
|
ihost_config.log=stderr; |
| 724 |
< |
log_msg(LOG_CRIT, "Failed to open Logfiles %s for writing", LOGFILE_PATH); |
| 724 |
> |
log_msg(LOG_CRIT, "Failed to open Logfiles %s for writing", LOG_FILE); |
| 725 |
|
exit(1); |
| 726 |
|
} |
| 727 |
|
|