[BACK]Return to log.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/log.c between version 1.25.2.1 and 1.25.2.2

version 1.25.2.1, 2003/09/16 20:50:43 version 1.25.2.2, 2004/03/04 18:18:15
Line 178 
Line 178 
         va_end(args);          va_end(args);
 }  }
   
 /* Fatal cleanup */  
   
 struct fatal_cleanup {  
         struct fatal_cleanup *next;  
         void (*proc) (void *);  
         void *context;  
 };  
   
 static struct fatal_cleanup *fatal_cleanups = NULL;  
   
 /* Registers a cleanup function to be called by fatal() before exiting. */  
   
 void  
 fatal_add_cleanup(void (*proc) (void *), void *context)  
 {  
         struct fatal_cleanup *cu;  
   
         cu = xmalloc(sizeof(*cu));  
         cu->proc = proc;  
         cu->context = context;  
         cu->next = fatal_cleanups;  
         fatal_cleanups = cu;  
 }  
   
 /* Removes a cleanup frunction to be called at fatal(). */  
   
 void  
 fatal_remove_cleanup(void (*proc) (void *context), void *context)  
 {  
         struct fatal_cleanup **cup, *cu;  
   
         for (cup = &fatal_cleanups; *cup; cup = &cu->next) {  
                 cu = *cup;  
                 if (cu->proc == proc && cu->context == context) {  
                         *cup = cu->next;  
                         xfree(cu);  
                         return;  
                 }  
         }  
         fatal("fatal_remove_cleanup: no such cleanup function: 0x%lx 0x%lx",  
             (u_long) proc, (u_long) context);  
 }  
   
 /* Remove all cleanups, to be called after fork() */  
 void  
 fatal_remove_all_cleanups(void)  
 {  
         struct fatal_cleanup *cu, *next_cu;  
   
         for (cu = fatal_cleanups; cu; cu = next_cu) {  
                 next_cu = cu->next;  
                 xfree(cu);  
         }  
         fatal_cleanups = NULL;  
 }  
   
 /* Cleanup and exit */  
 void  
 fatal_cleanup(void)  
 {  
         struct fatal_cleanup *cu, *next_cu;  
         static int called = 0;  
   
         if (called)  
                 exit(255);  
         called = 1;  
         /* Call cleanup functions. */  
         for (cu = fatal_cleanups; cu; cu = next_cu) {  
                 next_cu = cu->next;  
                 debug("Calling cleanup 0x%lx(0x%lx)",  
                     (u_long) cu->proc, (u_long) cu->context);  
                 (*cu->proc) (cu->context);  
         }  
         exit(255);  
 }  
   
   
 /*  /*
  * Initialize the log.   * Initialize the log.
  */   */

Legend:
Removed from v.1.25.2.1  
changed lines
  Added in v.1.25.2.2