diff options
Diffstat (limited to 'libc/misc/error')
-rw-r--r-- | libc/misc/error/err.c | 56 | ||||
-rw-r--r-- | libc/misc/error/error.c | 1 |
2 files changed, 34 insertions, 23 deletions
diff --git a/libc/misc/error/err.c b/libc/misc/error/err.c index 0d0637148..922cd8aba 100644 --- a/libc/misc/error/err.c +++ b/libc/misc/error/err.c @@ -5,6 +5,8 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ +#define vfprintf __vfprintf + #define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> @@ -34,7 +36,7 @@ static void vwarn_work(const char *format, va_list args, int showerr) f = fmt + 11; /* At 11. */ if (showerr) { f -= 4; /* At 7. */ - __xpg_strerror_r(errno, buf, sizeof(buf)); + __xpg_strerror_r_internal(errno, buf, sizeof(buf)); } __STDIO_AUTO_THREADLOCK(stderr); @@ -49,62 +51,70 @@ static void vwarn_work(const char *format, va_list args, int showerr) __STDIO_AUTO_THREADUNLOCK(stderr); } -extern void warn(const char *format, ...) +void attribute_hidden __vwarn(const char *format, va_list args) +{ + vwarn_work(format, args, 1); +} +strong_alias(__vwarn,vwarn) + +void warn(const char *format, ...) { va_list args; va_start(args, format); - vwarn(format, args); + __vwarn(format, args); va_end(args); } -extern void vwarn(const char *format, va_list args) +void attribute_hidden __vwarnx(const char *format, va_list args) { - vwarn_work(format, args, 1); + vwarn_work(format, args, 0); } +strong_alias(__vwarnx,vwarnx) -extern void warnx(const char *format, ...) +void warnx(const char *format, ...) { va_list args; va_start(args, format); - vwarnx(format, args); + __vwarnx(format, args); va_end(args); } -extern void vwarnx(const char *format, va_list args) +void attribute_hidden __verr(int status, const char *format, va_list args) { - vwarn_work(format, args, 0); + __vwarn(format, args); + exit(status); } +strong_alias(__verr,verr) -extern void err(int status, const char *format, ...) +void attribute_noreturn err(int status, const char *format, ...) { va_list args; va_start(args, format); - verr(status, format, args); + __verr(status, format, args); /* This should get optimized away. We'll leave it now for safety. */ - va_end(args); + /* The loop is added only to keep gcc happy. */ + while(1) + va_end(args); } -extern void verr(int status, const char *format, va_list args) +void attribute_hidden __verrx(int status, const char *format, va_list args) { - vwarn(format, args); + __vwarnx(format, args); exit(status); } +strong_alias(__verrx,verrx) -extern void errx(int status, const char *format, ...) +void attribute_noreturn errx(int status, const char *format, ...) { va_list args; va_start(args, format); - verrx(status, format, args); + __verrx(status, format, args); /* This should get optimized away. We'll leave it now for safety. */ - va_end(args); -} - -extern void verrx(int status, const char *format, va_list args) -{ - vwarnx(format, args); - exit(status); + /* The loop is added only to keep gcc happy. */ + while(1) + va_end(args); } diff --git a/libc/misc/error/error.c b/libc/misc/error/error.c index 0a19e3923..5427e9568 100644 --- a/libc/misc/error/error.c +++ b/libc/misc/error/error.c @@ -23,6 +23,7 @@ /* Adjusted slightly by Erik Andersen <andersen@uclibc.org> */ #define strerror __strerror +#define vfprintf __vfprintf #include <stdio.h> #include <stdarg.h> |