]> granicus.if.org Git - sudo/commitdiff
Rename warning2()/error2() -> warning_nodebug()/error_nodebug().
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 25 Nov 2012 14:34:10 +0000 (09:34 -0500)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 25 Nov 2012 14:34:10 +0000 (09:34 -0500)
common/alloc.c
common/list.c
include/error.h
plugins/sudoers/env.c
plugins/sudoers/plugin_error.c
plugins/sudoers/regress/check_symbols/check_symbols.c
plugins/sudoers/sudoreplay.c
plugins/sudoers/visudo.c
src/error.c
src/hooks.c

index 5c51365f12b2c4aa97b3543b8ce26056817a7e55..adc20072307d954af1014167202d7cfa4aeb1b66 100644 (file)
@@ -80,10 +80,10 @@ emalloc(size_t size)
     void *ptr;
 
     if (size == 0)
-       errorx2(1, _("internal error, tried to emalloc(0)"));
+       errorx_nodebug(1, _("internal error, tried to emalloc(0)"));
 
     if ((ptr = malloc(size)) == NULL)
-       errorx2(1, NULL);
+       errorx_nodebug(1, NULL);
     return ptr;
 }
 
@@ -97,13 +97,13 @@ emalloc2(size_t nmemb, size_t size)
     void *ptr;
 
     if (nmemb == 0 || size == 0)
-       errorx2(1, _("internal error, tried to emalloc2(0)"));
+       errorx_nodebug(1, _("internal error, tried to emalloc2(0)"));
     if (nmemb > SIZE_MAX / size)
-       errorx2(1, _("internal error, %s overflow"), "emalloc2()");
+       errorx_nodebug(1, _("internal error, %s overflow"), "emalloc2()");
 
     size *= nmemb;
     if ((ptr = malloc(size)) == NULL)
-       errorx2(1, NULL);
+       errorx_nodebug(1, NULL);
     return ptr;
 }
 
@@ -118,14 +118,14 @@ ecalloc(size_t nmemb, size_t size)
     void *ptr;
 
     if (nmemb == 0 || size == 0)
-       errorx2(1, _("internal error, tried to ecalloc(0)"));
+       errorx_nodebug(1, _("internal error, tried to ecalloc(0)"));
     if (nmemb != 1) {
        if (nmemb > SIZE_MAX / size)
-           errorx2(1, _("internal error, %s overflow"), "ecalloc()");
+           errorx_nodebug(1, _("internal error, %s overflow"), "ecalloc()");
        size *= nmemb;
     }
     if ((ptr = malloc(size)) == NULL)
-       errorx2(1, NULL);
+       errorx_nodebug(1, NULL);
     memset(ptr, 0, size);
     return ptr;
 }
@@ -140,11 +140,11 @@ erealloc(void *ptr, size_t size)
 {
 
     if (size == 0)
-       errorx2(1, _("internal error, tried to erealloc(0)"));
+       errorx_nodebug(1, _("internal error, tried to erealloc(0)"));
 
     ptr = ptr ? realloc(ptr, size) : malloc(size);
     if (ptr == NULL)
-       errorx2(1, NULL);
+       errorx_nodebug(1, NULL);
     return ptr;
 }
 
@@ -159,14 +159,14 @@ erealloc3(void *ptr, size_t nmemb, size_t size)
 {
 
     if (nmemb == 0 || size == 0)
-       errorx2(1, _("internal error, tried to erealloc3(0)"));
+       errorx_nodebug(1, _("internal error, tried to erealloc3(0)"));
     if (nmemb > SIZE_MAX / size)
-       errorx2(1, _("internal error, %s overflow"), "erealloc3()");
+       errorx_nodebug(1, _("internal error, %s overflow"), "erealloc3()");
 
     size *= nmemb;
     ptr = ptr ? realloc(ptr, size) : malloc(size);
     if (ptr == NULL)
-       errorx2(1, NULL);
+       errorx_nodebug(1, NULL);
     return ptr;
 }
 
@@ -183,14 +183,14 @@ erecalloc(void *ptr, size_t onmemb, size_t nmemb, size_t msize)
     size_t size;
 
     if (nmemb == 0 || msize == 0)
-       errorx2(1, _("internal error, tried to erecalloc(0)"));
+       errorx_nodebug(1, _("internal error, tried to erecalloc(0)"));
     if (nmemb > SIZE_MAX / msize)
-       errorx2(1, _("internal error, %s overflow"), "erecalloc()");
+       errorx_nodebug(1, _("internal error, %s overflow"), "erecalloc()");
 
     size = nmemb * msize;
     ptr = ptr ? realloc(ptr, size) : malloc(size);
     if (ptr == NULL)
-       errorx2(1, NULL);
+       errorx_nodebug(1, NULL);
     if (nmemb > onmemb) {
        size = (nmemb - onmemb) * msize;
        memset((char *)ptr + (onmemb * msize), 0, size);
@@ -255,7 +255,7 @@ easprintf(char **ret, const char *fmt, ...)
     va_end(ap);
 
     if (len == -1)
-       errorx2(1, NULL);
+       errorx_nodebug(1, NULL);
     return len;
 }
 
@@ -269,7 +269,7 @@ evasprintf(char **ret, const char *format, va_list args)
     int len;
 
     if ((len = vasprintf(ret, format, args)) == -1)
-       errorx2(1, NULL);
+       errorx_nodebug(1, NULL);
     return len;
 }
 
index a656a6e8e3b43a51dce288e7654a04a94810ea70..8f348e1796a3fbde8d9df7e0960dabc6992eb722 100644 (file)
@@ -81,7 +81,7 @@ list2tq(void *vh, void *vl)
     if (l != NULL) {
 #ifdef DEBUG
        if (l->prev == NULL) {
-           warningx2("list2tq called with non-semicircular list");
+           warningx_nodebug("list2tq called with non-semicircular list");
            abort();
        }
 #endif
index 20c2b6dc19d48d4436e762e17d46c06be624665e..aea0bb96b60fe7bbd269acaf80377c11d99e9bd7 100644 (file)
  */
 #if defined(SUDO_ERROR_WRAP) && SUDO_ERROR_WRAP == 0
 # if defined(__GNUC__) && __GNUC__ == 2
-#  define error(rval, fmt...) error2((rval), fmt)
-#  define errorx(rval, fmt...) errorx2((rval), fmt)
-#  define warning(fmt...) warning2(fmt)
-#  define warningx(fmt...) warningx2(fmt)
+#  define error(rval, fmt...) error_nodebug((rval), fmt)
+#  define errorx(rval, fmt...) errorx_nodebug((rval), fmt)
+#  define warning(fmt...) warning_nodebug(fmt)
+#  define warningx(fmt...) warningx_nodebug(fmt)
 # else
-#  define error(rval, ...) error2((rval), __VA_ARGS__)
-#  define errorx(rval, ...) errorx2((rval), __VA_ARGS__)
-#  define warning(...) warning2(__VA_ARGS__)
-#  define warningx(...) warningx2(__VA_ARGS__)
+#  define error(rval, ...) error_nodebug((rval), __VA_ARGS__)
+#  define errorx(rval, ...) errorx_nodebug((rval), __VA_ARGS__)
+#  define warning(...) warning_nodebug(__VA_ARGS__)
+#  define warningx(...) warningx_nodebug(__VA_ARGS__)
 # endif /* __GNUC__ == 2 */
-# define verror(rval, fmt, ap) error2((rval), (fmt), (ap))
-# define verrorx(rval, fmt, ap) errorx2((rval), (fmt), (ap))
-# define vwarning(fmt, ap) warning2((fmt), (ap))
-# define vwarningx(fmt, ap) warningx2((fmt), (ap))
+# define verror(rval, fmt, ap) error_nodebug((rval), (fmt), (ap))
+# define verrorx(rval, fmt, ap) errorx_nodebug((rval), (fmt), (ap))
+# define vwarning(fmt, ap) warning_nodebug((fmt), (ap))
+# define vwarningx(fmt, ap) warningx_nodebug((fmt), (ap))
 #else /* SUDO_ERROR_WRAP */
 # if defined(__GNUC__) && __GNUC__ == 2
 #  define error(rval, fmt...) do {                                            \
     sudo_debug_printf2(__func__, __FILE__, __LINE__,                          \
        SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO|SUDO_DEBUG_ERRNO|sudo_debug_subsys, \
        fmt);                                                                  \
-    error2((rval), fmt);                                                      \
+    error_nodebug((rval), fmt);                                                       \
 } while (0)
 #  define errorx(rval, fmt...) do {                                           \
     sudo_debug_printf2(__func__, __FILE__, __LINE__,                          \
        SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO|sudo_debug_subsys, fmt);            \
-    errorx2((rval), fmt);                                                     \
+    errorx_nodebug((rval), fmt);                                                      \
 } while (0)
 #  define warning(fmt...) do {                                                \
     sudo_debug_printf2(__func__, __FILE__, __LINE__,                          \
        SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO|SUDO_DEBUG_ERRNO|sudo_debug_subsys, \
        fmt);                                                                  \
-    warning2(fmt);                                                            \
+    warning_nodebug(fmt);                                                             \
 } while (0)
 #  define warningx(fmt...) do {                                                       \
     sudo_debug_printf2(__func__, __FILE__, __LINE__,                          \
        SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO|sudo_debug_subsys, fmt);            \
-    warningx2(fmt);                                                           \
+    warningx_nodebug(fmt);                                                            \
 } while (0)
 # else
 #  define error(rval, ...) do {                                                       \
     sudo_debug_printf2(__func__, __FILE__, __LINE__,                          \
        SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO|SUDO_DEBUG_ERRNO|sudo_debug_subsys, \
        __VA_ARGS__);                                                          \
-    error2((rval), __VA_ARGS__);                                              \
+    error_nodebug((rval), __VA_ARGS__);                                               \
 } while (0)
 #  define errorx(rval, ...) do {                                              \
     sudo_debug_printf2(__func__, __FILE__, __LINE__,                          \
        SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO|sudo_debug_subsys, __VA_ARGS__);    \
-    errorx2((rval), __VA_ARGS__);                                             \
+    errorx_nodebug((rval), __VA_ARGS__);                                              \
 } while (0)
 #  define warning(...) do {                                                   \
     sudo_debug_printf2(__func__, __FILE__, __LINE__,                          \
        SUDO_DEBUG_WARN|SUDO_DEBUG_LINENO|SUDO_DEBUG_ERRNO|sudo_debug_subsys,  \
        __VA_ARGS__);                                                          \
-    warning2(__VA_ARGS__);                                                    \
+    warning_nodebug(__VA_ARGS__);                                                     \
 } while (0)
 #  define warningx(...) do {                                                  \
     sudo_debug_printf2(__func__, __FILE__, __LINE__,                          \
        SUDO_DEBUG_WARN|SUDO_DEBUG_LINENO|sudo_debug_subsys, __VA_ARGS__);     \
-    warningx2(__VA_ARGS__);                                                   \
+    warningx_nodebug(__VA_ARGS__);                                                    \
 } while (0)
 # endif /* __GNUC__ == 2 */
 # define verror(rval, fmt, ap) do {                                                   \
     sudo_debug_vprintf2(__func__, __FILE__, __LINE__,                         \
        SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO|SUDO_DEBUG_ERRNO|sudo_debug_subsys, \
        (fmt), (ap));                                                          \
-    verror2((rval), (fmt), (ap));                                             \
+    verror_nodebug((rval), (fmt), (ap));                                              \
 } while (0)
 # define verrorx(rval, fmt, ap) do {                                          \
     sudo_debug_vprintf2(__func__, __FILE__, __LINE__,                         \
        SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO|sudo_debug_subsys, (fmt), (ap));    \
-    verrorx2((rval), (fmt), (ap));                                            \
+    verrorx_nodebug((rval), (fmt), (ap));                                             \
 } while (0)
 # define vwarning(fmt, ap) do {                                                       \
     sudo_debug_vprintf2(__func__, __FILE__, __LINE__,                         \
        SUDO_DEBUG_WARN|SUDO_DEBUG_LINENO|SUDO_DEBUG_ERRNO|sudo_debug_subsys,  \
        (fmt), (ap));                                                          \
-    vwarning2((fmt), (ap));                                                   \
+    vwarning_nodebug((fmt), (ap));                                                    \
 } while (0)
 # define vwarningx(fmt, ap) do {                                                      \
     sudo_debug_vprintf2(__func__, __FILE__, __LINE__,                         \
        SUDO_DEBUG_WARN|SUDO_DEBUG_LINENO|sudo_debug_subsys, (fmt), (ap));     \
-    vwarningx2((fmt), (ap));                                                  \
+    vwarningx_nodebug((fmt), (ap));                                                   \
 } while (0)
 #endif /* SUDO_ERROR_WRAP */
 
-void   error2(int, const char *, ...) __printflike(2, 3) __attribute__((__noreturn__));
-void   errorx2(int, const char *, ...) __printflike(2, 3) __attribute__((__noreturn__));
-void   verror2(int, const char *, va_list ap) __attribute__((__noreturn__));
-void   verrorx2(int, const char *, va_list ap) __attribute__((__noreturn__));
-void   warning2(const char *, ...) __printflike(1, 2);
-void   warningx2(const char *, ...) __printflike(1, 2);
-void   vwarning2(const char *, va_list ap);
-void   vwarningx2(const char *, va_list ap);
+void   error_nodebug(int, const char *, ...) __printflike(2, 3) __attribute__((__noreturn__));
+void   errorx_nodebug(int, const char *, ...) __printflike(2, 3) __attribute__((__noreturn__));
+void   verror_nodebug(int, const char *, va_list ap) __attribute__((__noreturn__));
+void   verrorx_nodebug(int, const char *, va_list ap) __attribute__((__noreturn__));
+void   warning_nodebug(const char *, ...) __printflike(1, 2);
+void   warningx_nodebug(const char *, ...) __printflike(1, 2);
+void   vwarning_nodebug(const char *, va_list ap);
+void   vwarningx_nodebug(const char *, va_list ap);
 
 #endif /* _SUDO_ERROR_H_ */
index ca0b0f4223d4f89f87f16888cef7994648dc812b..e937a995a3d3ebcf1709fe0d250135707bb63e97 100644 (file)
@@ -286,12 +286,12 @@ sudo_putenv_nodebug(char *str, bool dupcheck, bool overwrite)
        size_t nsize;
 
        if (env.env_size > SIZE_MAX - 128) {
-           errorx2(1, _("internal error, %s overflow"),
+           errorx_nodebug(1, _("internal error, %s overflow"),
                "sudo_putenv_nodebug()");
        }
        nsize = env.env_size + 128;
        if (nsize > SIZE_MAX / sizeof(char *)) {
-           errorx2(1, _("internal error, %s overflow"),
+           errorx_nodebug(1, _("internal error, %s overflow"),
                "sudo_putenv_nodebug()");
        }
        nenvp = realloc(env.envp, nsize * sizeof(char *));
index 9d88d69948cfad0ef500846029dc965f283183d7..ad5f6748dc9f3e3d5baf6bbfd45ddb1a7f27cf42 100644 (file)
@@ -40,7 +40,7 @@ sigjmp_buf error_jmp;
 extern sudo_conv_t sudo_conv;
 
 void
-error2(int eval, const char *fmt, ...)
+error_nodebug(int eval, const char *fmt, ...)
 {
     va_list ap;
 
@@ -55,7 +55,7 @@ error2(int eval, const char *fmt, ...)
 }
 
 void
-errorx2(int eval, const char *fmt, ...)
+errorx_nodebug(int eval, const char *fmt, ...)
 {
     va_list ap;
 
@@ -70,7 +70,7 @@ errorx2(int eval, const char *fmt, ...)
 }
 
 void
-verror2(int eval, const char *fmt, va_list ap)
+verror_nodebug(int eval, const char *fmt, va_list ap)
 {
     _warning(1, fmt, ap);
     sudoers_cleanup(0);
@@ -81,7 +81,7 @@ verror2(int eval, const char *fmt, va_list ap)
 }
 
 void
-verrorx2(int eval, const char *fmt, va_list ap)
+verrorx_nodebug(int eval, const char *fmt, va_list ap)
 {
     _warning(0, fmt, ap);
     sudoers_cleanup(0);
@@ -92,7 +92,7 @@ verrorx2(int eval, const char *fmt, va_list ap)
 }
 
 void
-warning2(const char *fmt, ...)
+warning_nodebug(const char *fmt, ...)
 {
     va_list ap;
 
@@ -102,7 +102,7 @@ warning2(const char *fmt, ...)
 }
 
 void
-warningx2(const char *fmt, ...)
+warningx_nodebug(const char *fmt, ...)
 {
     va_list ap;
     va_start(ap, fmt);
@@ -111,13 +111,13 @@ warningx2(const char *fmt, ...)
 }
 
 void
-vwarning2(const char *fmt, va_list ap)
+vwarning_nodebug(const char *fmt, va_list ap)
 {
     _warning(1, fmt, ap);
 }
 
 void
-vwarningx2(const char *fmt, va_list ap)
+vwarningx_nodebug(const char *fmt, va_list ap)
 {
     _warning(0, fmt, ap);
 }
index 98fb9cf146eac10d04b5de31b06a8f6a71adade0..ce9ddd25ea42a02c7d2b6ac40f486bf814015a34 100644 (file)
@@ -80,11 +80,11 @@ main(int argc, char *argv[])
 
     handle = dlopen(plugin_path, RTLD_LAZY|RTLD_GLOBAL);
     if (handle == NULL)
-       errorx2(1, "unable to dlopen %s: %s", plugin_path, dlerror());
+       errorx_nodebug(1, "unable to dlopen %s: %s", plugin_path, dlerror());
 
     fp = fopen(symbols_file, "r");
     if (fp == NULL)
-       error2(1, "unable to open %s", symbols_file);
+       error_nodebug(1, "unable to open %s", symbols_file);
 
     while (fgets(line, sizeof(line), fp) != NULL) {
        ntests++;
@@ -92,7 +92,7 @@ main(int argc, char *argv[])
            *cp = '\0';
        sym = dlsym(handle, line);
        if (sym == NULL) {
-           warningx2("unable to resolve symbol %s: %s", line, dlerror());
+           warningx_nodebug("unable to resolve symbol %s: %s", line, dlerror());
            errors++;
        }
     }
@@ -102,7 +102,7 @@ main(int argc, char *argv[])
      */
     sym = dlsym(handle, "user_in_group");
     if (sym != NULL) {
-       warningx2("able to resolve local symbol user_in_group");
+       warningx_nodebug("able to resolve local symbol user_in_group");
        errors++;
     }
     ntests++;
index d807c5f6c6a18c9cbddc28cb17933f5778231c5e..5d3c5b270f30318337fec4ab7a949957d7bffde4 100644 (file)
@@ -525,7 +525,7 @@ delay(double secs)
       rval = nanosleep(&ts, &rts);
     } while (rval == -1 && errno == EINTR);
     if (rval == -1) {
-       error2(1, _("nanosleep: tv_sec %ld, tv_nsec %ld"),
+       error_nodebug(1, _("nanosleep: tv_sec %ld, tv_nsec %ld"),
            (long)ts.tv_sec, (long)ts.tv_nsec);
     }
 }
index b81846265bd145e0a6191ca01789008908d912e1..9a5ccdd7dd7fb6fa521627e7bc7fd037e9073293 100644 (file)
@@ -1243,7 +1243,7 @@ print_unused(void *v1, void *v2)
     struct alias *a = (struct alias *)v1;
     char *prefix = (char *)v2;
 
-    warningx2(_("%s: unused %s_Alias %s"), prefix,
+    warningx_nodebug(_("%s: unused %s_Alias %s"), prefix,
        a->type == HOSTALIAS ? "Host" : a->type == CMNDALIAS ? "Cmnd" :
        a->type == USERALIAS ? "User" : a->type == RUNASALIAS ? "Runas" :
        "Unknown", a->name);
index 7736da77d2d5145111d5d3e966688adc84eb3490..86207d7d0e04b7967de705d66e645ea01262649a 100644 (file)
@@ -33,7 +33,7 @@ static void _warning(int, const char *, va_list);
        void cleanup(int);
 
 void
-error2(int eval, const char *fmt, ...)
+error_nodebug(int eval, const char *fmt, ...)
 {
     va_list ap;
     va_start(ap, fmt);
@@ -44,7 +44,7 @@ error2(int eval, const char *fmt, ...)
 }
 
 void
-errorx2(int eval, const char *fmt, ...)
+errorx_nodebug(int eval, const char *fmt, ...)
 {
     va_list ap;
     va_start(ap, fmt);
@@ -55,7 +55,7 @@ errorx2(int eval, const char *fmt, ...)
 }
 
 void
-verror2(int eval, const char *fmt, va_list ap)
+verror_nodebug(int eval, const char *fmt, va_list ap)
 {
     _warning(1, fmt, ap);
     cleanup(0);
@@ -63,7 +63,7 @@ verror2(int eval, const char *fmt, va_list ap)
 }
 
 void
-verrorx2(int eval, const char *fmt, va_list ap)
+verrorx_nodebug(int eval, const char *fmt, va_list ap)
 {
     _warning(0, fmt, ap);
     cleanup(0);
@@ -71,7 +71,7 @@ verrorx2(int eval, const char *fmt, va_list ap)
 }
 
 void
-warning2(const char *fmt, ...)
+warning_nodebug(const char *fmt, ...)
 {
     va_list ap;
     va_start(ap, fmt);
@@ -80,7 +80,7 @@ warning2(const char *fmt, ...)
 }
 
 void
-warningx2(const char *fmt, ...)
+warningx_nodebug(const char *fmt, ...)
 {
     va_list ap;
     va_start(ap, fmt);
@@ -89,13 +89,13 @@ warningx2(const char *fmt, ...)
 }
 
 void
-vwarning2(const char *fmt, va_list ap)
+vwarning_nodebug(const char *fmt, va_list ap)
 {
     _warning(1, fmt, ap);
 }
 
 void
-vwarningx2(const char *fmt, va_list ap)
+vwarningx_nodebug(const char *fmt, va_list ap)
 {
     _warning(0, fmt, ap);
 }
index 7c49bb9a6bd4752cbaf355a36e5ce011c27aae42..1c5f4f4b54b95ee9bb66974d7b47fe06cf97fba5 100644 (file)
@@ -77,7 +77,7 @@ process_hooks_setenv(const char *name, const char *value, int overwrite)
            case SUDO_HOOK_RET_STOP:
                goto done;
            default:
-               warningx2("invalid setenv hook return value: %d", rc);
+               warningx_nodebug("invalid setenv hook return value: %d", rc);
                break;
        }
     }
@@ -102,7 +102,7 @@ process_hooks_putenv(char *string)
            case SUDO_HOOK_RET_STOP:
                goto done;
            default:
-               warningx2("invalid putenv hook return value: %d", rc);
+               warningx_nodebug("invalid putenv hook return value: %d", rc);
                break;
        }
     }
@@ -128,7 +128,7 @@ process_hooks_getenv(const char *name, char **value)
            case SUDO_HOOK_RET_STOP:
                goto done;
            default:
-               warningx2("invalid getenv hook return value: %d", rc);
+               warningx_nodebug("invalid getenv hook return value: %d", rc);
                break;
        }
     }
@@ -155,7 +155,7 @@ process_hooks_unsetenv(const char *name)
            case SUDO_HOOK_RET_STOP:
                goto done;
            default:
-               warningx2("invalid unsetenv hook return value: %d", rc);
+               warningx_nodebug("invalid unsetenv hook return value: %d", rc);
                break;
        }
     }