--- projects/cms/source/ihost/ihost.c 2002/05/21 16:47:12 1.23 +++ projects/cms/source/ihost/ihost.c 2002/05/22 09:01:01 1.25 @@ -33,7 +33,7 @@ #include #include -#define VERSION_NO "0.8" +#define VERSION_NO "1.0rc1" #define RECONFIGURE_RETURN_CODE 2 #define UDP_MAX_PACKET_SIZE 8192 #define PID_FILE "/var/tmp/.ihost.pid" @@ -139,7 +139,8 @@ int ihost_configure(ihost_state_t *ihost_state){ logmessage(LOG_ERR, "sa family is wrong type"); return -1; } - + + if(ihost_state->my_ip!=NULL) free(ihost_state->my_ip); if((ihost_state->my_ip=strdup(inet_ntoa(((struct sockaddr_in *)&ip)->sin_addr)))==NULL){ logmessage(LOG_ERR, "Failed to get IP (%m)"); return -1; @@ -485,6 +486,7 @@ int main(int argc, char **argv){ ihost_state.last_modified=NULL; ihost_state.files_list=NULL; ihost_state.key=NULL; + ihost_state.my_ip=NULL; errf_set_progname(argv[0]); @@ -577,10 +579,10 @@ int main(int argc, char **argv){ logmessage(LOG_DEBUG,"Writing PID FILE"); pid=getpid(); if((f=fopen(PID_FILE,"w")) == NULL){ - logmessage(LOG_WARNING, "Failed to write PID file"); + logmessage(LOG_WARNING, "Failed to write PID file (%m)"); }else{ - if((fprintf(f,"%d",(int)pid)) > 0 ){ - logmessage(LOG_WARNING, "Failed to write PID file"); + if((fprintf(f,"%d",(int)pid)) <= 0 ){ + logmessage(LOG_WARNING, "Failed to write PID file (%m)"); } if((fclose(f))!=0){ logmessage(LOG_ERR, "failed to close PID file");