From 8d6f4b8517e4e3b1844e3227b4cde4be423154b3 Mon Sep 17 00:00:00 2001 From: Matthieu Herrb Date: Sun, 23 Oct 2016 20:35:45 +0000 Subject: Augment the chances LogOutOfMem() works in out-of-memory conditions. All instances are called with only one constant string so no need for varargs dance. --- app/xenodm/include/dm_error.h | 2 +- app/xenodm/xenodm/error.c | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'app/xenodm') diff --git a/app/xenodm/include/dm_error.h b/app/xenodm/include/dm_error.h index eecc14aa6..20aa00fba 100644 --- a/app/xenodm/include/dm_error.h +++ b/app/xenodm/include/dm_error.h @@ -39,7 +39,7 @@ extern void InitErrorLog (void); extern void LogAppend (const char * fmt, ...) _X_ATTRIBUTE_PRINTF(1,2); extern void LogError (const char * fmt, ...) _X_ATTRIBUTE_PRINTF(1,2); extern void LogInfo (const char * fmt, ...) _X_ATTRIBUTE_PRINTF(1,2); -extern void LogOutOfMem (const char * fmt, ...) _X_ATTRIBUTE_PRINTF(1,2); +extern void LogOutOfMem (const char * function); extern __dead void LogPanic (const char * fmt, ...) _X_ATTRIBUTE_PRINTF(1,2); diff --git a/app/xenodm/xenodm/error.c b/app/xenodm/xenodm/error.c index 59ae069a5..f41d09aab 100644 --- a/app/xenodm/xenodm/error.c +++ b/app/xenodm/xenodm/error.c @@ -98,15 +98,11 @@ LogPanic (const char * fmt, ...) } void -LogOutOfMem (const char * fmt, ...) +LogOutOfMem (const char *function) { - fprintf (stderr, "xdm: out of memory in routine "); - { - va_list args; - va_start(args, fmt); - vfprintf (stderr, fmt, args); - va_end(args); - } + fputs("xdm: out of memory in routine ", stderr); + fputs(function, stderr); + fputc('\n', stderr); fflush (stderr); } -- cgit v1.2.3