Patchwork [2/3] libpayload: Move stdin/stdout/stderr away from headers

login
register
about
Submitter Patrick Georgi
Date 2011-02-15 14:46:48
Message ID <1297942045.3976.39.camel@linux-0a8x.site>
Download mbox | patch
Permalink /patch/2673/
State Superseded
Headers show

Comments

Patrick Georgi - 2011-02-15 14:46:48
Otherwise they exist in several object files, confusing the linker

Signed-off-by: Patrick Georgi <patrick.georgi@secunet.com>
---
 payloads/libpayload/include/stdio.h |    4 +---
 payloads/libpayload/libc/printf.c   |    4 ++++
 2 files changed, 5 insertions(+), 3 deletions(-)

Patch

diff --git a/payloads/libpayload/include/stdio.h b/payloads/libpayload/include/stdio.h
index fb40a0d..b82f380 100644
--- a/payloads/libpayload/include/stdio.h
+++ b/payloads/libpayload/include/stdio.h
@@ -37,9 +37,7 @@  struct _FILE {
 
 typedef struct _FILE FILE;
 
-FILE *stdout = &_stdout;
-FILE *stdin = &_stdin;
-FILE *stderr = &_stderr;
+extern FILE *stdout, *stdin, *stderr;
 
 /**
  * @defgroup printf Print functions
diff --git a/payloads/libpayload/libc/printf.c b/payloads/libpayload/libc/printf.c
index a1ebb14..5a84ee2 100644
--- a/payloads/libpayload/libc/printf.c
+++ b/payloads/libpayload/libc/printf.c
@@ -36,6 +36,10 @@ 
 #include <libpayload.h>
 #include <ctype.h>
 
+FILE *stdout = &_stdout;
+FILE *stdin = &_stdin;
+FILE *stderr = &_stderr;
+
 /** Structure for specifying output methods for different printf clones. */
 struct printf_spec {
 	/* Output function, returns count of printed characters or EOF. */