Use fprintf(stderr, ...) in library
authorPatrick Georgi <patrick.georgi@secunet.com>
Mon, 14 Feb 2011 19:26:22 +0000 (19:26 +0000)
committerPatrick Georgi <patrick.georgi@coresystems.de>
Mon, 14 Feb 2011 19:26:22 +0000 (19:26 +0000)
Signed-off-by: Patrick Georgi <patrick.georgi@secunet.com>
Acked-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@6359 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

payloads/libpayload/include/assert.h
payloads/libpayload/libc/lib.c

index fda4bc063c98710e35528a34be0006ccc1a1beb9..9968504a441219f603b62c367873525ccca75fc8 100644 (file)
@@ -28,6 +28,7 @@
  */
 
 #include <stdlib.h>
+#include <stdio.h>
 
 // assert's existence depends on NDEBUG state on _last_ inclusion of assert.h,
 // so don't guard this against double-includes.
@@ -35,5 +36,5 @@
 // Heisenbugs appear if statement has side-effects. This could be worked around but does the standard allow for that?
 #define assert(statement)
 #else
-#define assert(statement) if ((statement) == 0) { printf("assertion failed in file %s, function %s(), line %s\n", __FILE__, __FUNCTION__, __LINE__); abort(); }
+#define assert(statement) if ((statement) == 0) { fprintf(stderr, "assertion failed in file %s, function %s(), line %s\n", __FILE__, __FUNCTION__, __LINE__); abort(); }
 #endif
index baccc07701b78c0b54e7927d8e691f481dd70ade..c8539cb59fc2aea4f57948fb550004e6faaabf1c 100644 (file)
@@ -109,7 +109,7 @@ u8 hex2bin(u8 h)
  */
 void fatal(const char *msg)
 {
-       printf("%s",msg);
+       fprintf(stderr, "%s",msg);
        halt();
 }