aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/os/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/os/log.c')
-rw-r--r--xorg-server/os/log.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/xorg-server/os/log.c b/xorg-server/os/log.c
index f997e3eee..ee231a31d 100644
--- a/xorg-server/os/log.c
+++ b/xorg-server/os/log.c
@@ -127,7 +127,7 @@ static Bool needBuffer = TRUE;
#include <AvailabilityMacros.h>
static char __crashreporter_info_buff__[4096] = {0};
-static const char *__crashreporter_info__ = &__crashreporter_info_buff__[0];
+static const char *__crashreporter_info__ __attribute__((__used__)) = &__crashreporter_info_buff__[0];
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
// This is actually a toolchain requirement, but I'm not sure the correct check,
// but it should be fine to just only include it for Leopard and later. This line
@@ -583,21 +583,14 @@ ErrorF(const char * f, ...)
/* A perror() workalike. */
void
-Error(char *str)
+Error(const char *str)
{
- char *err = NULL;
- int saveErrno = errno;
-
- if (str) {
- err = malloc(strlen(strerror(saveErrno)) + strlen(str) + 2 + 1);
- if (!err)
- return;
- sprintf(err, "%s: ", str);
- strcat(err, strerror(saveErrno));
+ const char *err = strerror(errno);
+
+ if (str)
+ LogWrite(-1, "%s: %s", str, err);
+ else
LogWrite(-1, "%s", err);
- free(err);
- } else
- LogWrite(-1, "%s", strerror(saveErrno));
}
void