From: Todd C. Miller Date: Sun, 25 Nov 2012 14:34:10 +0000 (-0500) Subject: Rename warning2()/error2() -> warning_nodebug()/error_nodebug(). X-Git-Tag: SUDO_1_8_7~1^2~318 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4bde57b8b2c76f2e4abed94a22974edde02693d6;p=sudo Rename warning2()/error2() -> warning_nodebug()/error_nodebug(). --- diff --git a/common/alloc.c b/common/alloc.c index 5c51365f1..adc200723 100644 --- a/common/alloc.c +++ b/common/alloc.c @@ -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; } diff --git a/common/list.c b/common/list.c index a656a6e8e..8f348e179 100644 --- a/common/list.c +++ b/common/list.c @@ -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 diff --git a/include/error.h b/include/error.h index 20c2b6dc1..aea0bb96b 100644 --- a/include/error.h +++ b/include/error.h @@ -25,99 +25,99 @@ */ #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_ */ diff --git a/plugins/sudoers/env.c b/plugins/sudoers/env.c index ca0b0f422..e937a995a 100644 --- a/plugins/sudoers/env.c +++ b/plugins/sudoers/env.c @@ -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 *)); diff --git a/plugins/sudoers/plugin_error.c b/plugins/sudoers/plugin_error.c index 9d88d6994..ad5f6748d 100644 --- a/plugins/sudoers/plugin_error.c +++ b/plugins/sudoers/plugin_error.c @@ -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); } diff --git a/plugins/sudoers/regress/check_symbols/check_symbols.c b/plugins/sudoers/regress/check_symbols/check_symbols.c index 98fb9cf14..ce9ddd25e 100644 --- a/plugins/sudoers/regress/check_symbols/check_symbols.c +++ b/plugins/sudoers/regress/check_symbols/check_symbols.c @@ -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++; diff --git a/plugins/sudoers/sudoreplay.c b/plugins/sudoers/sudoreplay.c index d807c5f6c..5d3c5b270 100644 --- a/plugins/sudoers/sudoreplay.c +++ b/plugins/sudoers/sudoreplay.c @@ -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); } } diff --git a/plugins/sudoers/visudo.c b/plugins/sudoers/visudo.c index b81846265..9a5ccdd7d 100644 --- a/plugins/sudoers/visudo.c +++ b/plugins/sudoers/visudo.c @@ -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); diff --git a/src/error.c b/src/error.c index 7736da77d..86207d7d0 100644 --- a/src/error.c +++ b/src/error.c @@ -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); } diff --git a/src/hooks.c b/src/hooks.c index 7c49bb9a6..1c5f4f4b5 100644 --- a/src/hooks.c +++ b/src/hooks.c @@ -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; } }