diff options
Diffstat (limited to 'os')
-rw-r--r-- | os/backtrace.c | 5 | ||||
-rw-r--r-- | os/log.c | 14 | ||||
-rw-r--r-- | os/xprintf.c | 5 |
3 files changed, 6 insertions, 18 deletions
diff --git a/os/backtrace.c b/os/backtrace.c index 7ca6dab6d..58b4b1f34 100644 --- a/os/backtrace.c +++ b/os/backtrace.c @@ -27,6 +27,8 @@ #include "os.h" #include "misc.h" +#include <errno.h> +#include <string.h> #ifdef HAVE_BACKTRACE #ifndef _GNU_SOURCE @@ -199,9 +201,8 @@ void xorg_backtrace(void) { walkcontext(&u, xorg_backtrace_frame, &depth); else # endif - Error("Failed to get backtrace info"); + ErrorF("Failed to get backtrace info: %s\n", strerror(errno)); } - ErrorF("\n"); } # else @@ -87,7 +87,6 @@ OR PERFORMANCE OF THIS SOFTWARE. #include <sys/stat.h> #include <stdarg.h> #include <stdlib.h> /* for malloc() */ -#include <errno.h> #include "input.h" #include "site.h" @@ -638,19 +637,6 @@ ErrorF(const char * f, ...) va_end(args); } -/* A perror() workalike. */ - -void -Error(const char *str) -{ - const char *err = strerror(errno); - - if (str) - LogWrite(-1, "%s: %s", str, err); - else - LogWrite(-1, "%s", err); -} - void LogPrintMarkers(void) { diff --git a/os/xprintf.c b/os/xprintf.c index 254b7374a..3b4bb4117 100644 --- a/os/xprintf.c +++ b/os/xprintf.c @@ -64,6 +64,8 @@ #include "os.h" #include <stdarg.h> #include <stdio.h> +#include <errno.h> +#include <string.h> #ifdef asprintf # undef asprintf @@ -154,8 +156,7 @@ XNFvasprintf(char **ret, const char * _X_RESTRICT_KYWD format, va_list va) { int size = vasprintf(ret, format, va); if ((size == -1) || (*ret == NULL)) { - Error("XNFvasprintf"); - FatalError("XNFvasprintf failed"); + FatalError("XNFvasprintf failed: %s", strerror(errno)); } return size; } |