logo       

nagios/xdata xrddefault.c,1.26,1.27: msg#00025

Subject: nagios/xdata xrddefault.c,1.26,1.27
Update of /cvsroot/nagios/nagios/xdata
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29154/xdata

Modified Files:
        xrddefault.c 
Log Message:
Bug fixes, etc.

Index: xrddefault.c
===================================================================
RCS file: /cvsroot/nagios/nagios/xdata/xrddefault.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** xrddefault.c        11 Jan 2005 04:53:08 -0000      1.26
--- xrddefault.c        19 Mar 2005 22:16:06 -0000      1.27
***************
*** 4,8 ****
   *
   * Copyright (c) 1999-2005 Ethan Galstad (nagios@xxxxxxxxxx)
!  * Last Modified:   01-10-2005
   *
   * License:
--- 4,8 ----
   *
   * Copyright (c) 1999-2005 Ethan Galstad (nagios@xxxxxxxxxx)
!  * Last Modified:   03-19-2005
   *
   * License:
***************
*** 70,73 ****
--- 70,74 ----
  
  char xrddefault_retention_file[MAX_FILENAME_LENGTH]="";
+ char xrddefault_temp_file[MAX_FILENAME_LENGTH]="";
  
  
***************
*** 86,90 ****
--- 87,93 ----
        /* initialize the location of the retention file */
        
strncpy(xrddefault_retention_file,DEFAULT_RETENTION_FILE,sizeof(xrddefault_retention_file)-1);
+       
strncpy(xrddefault_temp_file,DEFAULT_TEMP_FILE,sizeof(xrddefault_temp_file)-1);
        xrddefault_retention_file[sizeof(xrddefault_retention_file)-1]='\x0';
+       xrddefault_temp_file[sizeof(xrddefault_temp_file)-1]='\x0';
  
        /* open the main config file for reading */
***************
*** 150,159 ****
  int xrddefault_save_state_information(char *main_config_file){
        char temp_buffer[MAX_INPUT_BUFFER];
        time_t current_time;
        int result=OK;
!       FILE *fp;
        host *temp_host=NULL;
        service *temp_service=NULL;
!       int x;
  
  #ifdef DEBUG0
--- 153,163 ----
  int xrddefault_save_state_information(char *main_config_file){
        char temp_buffer[MAX_INPUT_BUFFER];
+       char temp_file[MAX_FILENAME_LENGTH];
        time_t current_time;
        int result=OK;
!       FILE *fp=NULL;
        host *temp_host=NULL;
        service *temp_service=NULL;
!       int x, fd=0;
  
  #ifdef DEBUG0
***************
*** 171,179 ****
                }
  
!       /* open the retention file for writing */
!       fp=fopen(xrddefault_retention_file,"w");
        if(fp==NULL){
  
!               snprintf(temp_buffer,sizeof(temp_buffer)-1,"Error: Could not 
open state retention file '%s' for writing!\n",xrddefault_retention_file);
                temp_buffer[sizeof(temp_buffer)-1]='\x0';
                write_to_logs_and_console(temp_buffer,NSLOG_RUNTIME_ERROR,TRUE);
--- 175,190 ----
                }
  
!       /* open a safe temp file for output */
!       snprintf(temp_file,sizeof(temp_file)-1,"%sXXXXXX",xrddefault_temp_file);
!       temp_file[sizeof(temp_file)-1]='\x0';
!       if((fd=mkstemp(temp_file))==-1)
!               return ERROR;
!       fp=fdopen(fd,"w");
        if(fp==NULL){
  
!               close(fd);
!               unlink(temp_file);
! 
!               snprintf(temp_buffer,sizeof(temp_buffer)-1,"Error: Could not 
open temp state retention file '%s' for writing!\n",temp_file);
                temp_buffer[sizeof(temp_buffer)-1]='\x0';
                write_to_logs_and_console(temp_buffer,NSLOG_RUNTIME_ERROR,TRUE);
***************
*** 330,333 ****
--- 341,347 ----
        fclose(fp);
  
+       /* move the temp file to the retention file (overwrite the old 
retention file) */
+       if(my_rename(temp_file,xrddefault_retention_file))
+               return ERROR;
  
  



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
linux.arklinux....    user-groups.lin...    kde.usability/2...    ietf.ipp/2002-0...    mail.spam.spamc...    os.netbsd.devel...    audio.cd-record...    text.unicode.de...    php.documentati...    games.fps.halfl...    window-managers...    suse.oracle.gen...    bug-tracking.gn...    video.dvdrip.us...    xfree86.cvs/200...    java.netbeans.m...    network.argus/2...    culture.sf.kill...    debian.ports.al...    freebsd.questio...    qplus.devel/200...    handhelds.palm....   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe