Diff for /embedaddon/sudo/common/fatal.c between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2013/10/14 07:56:33 version 1.1.1.2, 2014/06/15 16:12:54
Line 28 Line 28
 # include "compat/stdbool.h"  # include "compat/stdbool.h"
 #endif /* HAVE_STDBOOL_H */  #endif /* HAVE_STDBOOL_H */
   
   #define DEFAULT_TEXT_DOMAIN     "sudo"
   #include "gettext.h"            /* must be included before missing.h */
   
 #include "missing.h"  #include "missing.h"
 #include "alloc.h"  #include "alloc.h"
 #include "fatal.h"  #include "fatal.h"
   #include "queue.h"
 #include "sudo_plugin.h"  #include "sudo_plugin.h"
   
#define DEFAULT_TEXT_DOMAIN     "sudo"struct sudo_fatal_callback {
#include "gettext.h"    SLIST_ENTRY(sudo_fatal_callback) entries;
     void (*func)(void);
 };
 SLIST_HEAD(sudo_fatal_callback_list, sudo_fatal_callback);
   
 sigjmp_buf fatal_jmp;  sigjmp_buf fatal_jmp;
 static bool setjmp_enabled = false;  static bool setjmp_enabled = false;
static struct sudo_fatal_callback {static struct sudo_fatal_callback_list callbacks;
    void (*func)(void); 
    struct sudo_fatal_callback *next; 
} *callbacks; 
   
 static void _warning(int, const char *, va_list);  static void _warning(int, const char *, va_list);
   
Line 51  do_cleanup(void) Line 55  do_cleanup(void)
     struct sudo_fatal_callback *cb;      struct sudo_fatal_callback *cb;
   
     /* Run callbacks, removing them from the list as we go. */      /* Run callbacks, removing them from the list as we go. */
    while ((cb = callbacks) != NULL) {    while ((cb = SLIST_FIRST(&callbacks)) != NULL) {
        callbacks = cb->next;        SLIST_REMOVE_HEAD(&callbacks, entries);
         cb->func();          cb->func();
         free(cb);          free(cb);
     }      }
 }  }
   
 void  void
fatal2(const char *fmt, ...)fatal_nodebug(const char *fmt, ...)
 {  {
     va_list ap;      va_list ap;
   
Line 74  fatal2(const char *fmt, ...) Line 78  fatal2(const char *fmt, ...)
 }  }
   
 void  void
fatalx2(const char *fmt, ...)fatalx_nodebug(const char *fmt, ...)
 {  {
     va_list ap;      va_list ap;
   
Line 89  fatalx2(const char *fmt, ...) Line 93  fatalx2(const char *fmt, ...)
 }  }
   
 void  void
vfatal2(const char *fmt, va_list ap)vfatal_nodebug(const char *fmt, va_list ap)
 {  {
     _warning(1, fmt, ap);      _warning(1, fmt, ap);
     do_cleanup();      do_cleanup();
Line 100  vfatal2(const char *fmt, va_list ap) Line 104  vfatal2(const char *fmt, va_list ap)
 }  }
   
 void  void
vfatalx2(const char *fmt, va_list ap)vfatalx_nodebug(const char *fmt, va_list ap)
 {  {
     _warning(0, fmt, ap);      _warning(0, fmt, ap);
     do_cleanup();      do_cleanup();
Line 111  vfatalx2(const char *fmt, va_list ap) Line 115  vfatalx2(const char *fmt, va_list ap)
 }  }
   
 void  void
warning2(const char *fmt, ...)warning_nodebug(const char *fmt, ...)
 {  {
     va_list ap;      va_list ap;
   
Line 121  warning2(const char *fmt, ...) Line 125  warning2(const char *fmt, ...)
 }  }
   
 void  void
warningx2(const char *fmt, ...)warningx_nodebug(const char *fmt, ...)
 {  {
     va_list ap;      va_list ap;
     va_start(ap, fmt);      va_start(ap, fmt);
Line 130  warningx2(const char *fmt, ...) Line 134  warningx2(const char *fmt, ...)
 }  }
   
 void  void
vwarning2(const char *fmt, va_list ap)vwarning_nodebug(const char *fmt, va_list ap)
 {  {
     _warning(1, fmt, ap);      _warning(1, fmt, ap);
 }  }
   
 void  void
vwarningx2(const char *fmt, va_list ap)vwarningx_nodebug(const char *fmt, va_list ap)
 {  {
     _warning(0, fmt, ap);      _warning(0, fmt, ap);
 }  }
Line 173  fatal_callback_register(void (*func)(void)) Line 177  fatal_callback_register(void (*func)(void))
     if (cb == NULL)      if (cb == NULL)
         return -1;          return -1;
     cb->func = func;      cb->func = func;
    cb->next = callbacks;    SLIST_INSERT_HEAD(&callbacks, cb, entries);
    callbacks = cb; 
   
     return 0;      return 0;
 }  }

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>