ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/ihost/ihost.c
(Generate patch)

Comparing projects/cms/source/ihost/ihost.c (file contents):
Revision 1.24 by pajs, Tue May 21 16:55:59 2002 UTC vs.
Revision 1.26 by tdb, Wed May 29 19:41:59 2002 UTC

# Line 18 | Line 18
18   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19   */
20  
21 + #ifdef HAVE_CONFIG_H
22 + #include "config.h"
23 + #endif
24 +
25   #include <stdio.h>
26   #include <stdlib.h>
27   #include <sys/types.h>
# Line 33 | Line 37
37   #include <arpa/inet.h>
38   #include <syslog.h>
39  
36 #define VERSION_NO "1.0rc1"
40   #define RECONFIGURE_RETURN_CODE 2
41   #define UDP_MAX_PACKET_SIZE 8192
42   #define PID_FILE "/var/tmp/.ihost.pid"
# Line 139 | Line 142 | int ihost_configure(ihost_state_t *ihost_state){
142                  logmessage(LOG_ERR, "sa family is wrong type");
143                  return -1;
144          }
145 <        
145 >
146 >        if(ihost_state->my_ip!=NULL) free(ihost_state->my_ip);  
147          if((ihost_state->my_ip=strdup(inet_ntoa(((struct sockaddr_in *)&ip)->sin_addr)))==NULL){
148                  logmessage(LOG_ERR, "Failed to get IP (%m)");
149                  return -1;
# Line 485 | Line 489 | int main(int argc, char **argv){
489          ihost_state.last_modified=NULL;
490          ihost_state.files_list=NULL;
491          ihost_state.key=NULL;
492 +        ihost_state.my_ip=NULL;
493  
494          errf_set_progname(argv[0]);
495          
# Line 510 | Line 515 | int main(int argc, char **argv){
515                                  break;
516  
517                          case 'V':
518 <                                errf("%s version %s",argv[0], VERSION_NO);
518 >                                errf("%s version %s",argv[0], VERSION);
519                                  break;
520  
521                          default:
# Line 577 | Line 582 | int main(int argc, char **argv){
582          logmessage(LOG_DEBUG,"Writing PID FILE");
583          pid=getpid();
584          if((f=fopen(PID_FILE,"w")) == NULL){
585 <                logmessage(LOG_WARNING, "Failed to write PID file");
585 >                logmessage(LOG_WARNING, "Failed to write PID file (%m)");
586          }else{
587 <                if((fprintf(f,"%d",(int)pid)) > 0 ){
588 <                        logmessage(LOG_WARNING, "Failed to write PID file");
587 >                if((fprintf(f,"%d",(int)pid)) <= 0 ){
588 >                        logmessage(LOG_WARNING, "Failed to write PID file (%m)");
589                  }
590                  if((fclose(f))!=0){
591                          logmessage(LOG_ERR, "failed to close PID file");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines