[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] xenstore: Do not assign to stdout/stderr/stdin - they are not
# HG changeset patch # User kfraser@xxxxxxxxxxxxxxxxxxxxx # Date 1185992228 -3600 # Node ID f343d3c16dccbe6215bddcd04a0524ab06b4cab0 # Parent 88bb0d305308a2cab31fd8559a6a2719db1ea55a xenstore: Do not assign to stdout/stderr/stdin - they are not implemented as variables on all systems. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> --- tools/xenstore/utils.c | 7 +++---- tools/xenstore/utils.h | 2 +- tools/xenstore/xenstored_core.c | 6 +----- 3 files changed, 5 insertions(+), 10 deletions(-) diff -r 88bb0d305308 -r f343d3c16dcc tools/xenstore/utils.c --- a/tools/xenstore/utils.c Wed Aug 01 15:47:54 2007 +0100 +++ b/tools/xenstore/utils.c Wed Aug 01 19:17:08 2007 +0100 @@ -10,18 +10,17 @@ #include <signal.h> #include "utils.h" -void xprintf(const char *fmt, ...) +static void default_xprintf(const char *fmt, ...) { va_list args; - - if (!stderr) - return; /* could trace()? */ va_start(args, fmt); vfprintf(stderr, fmt, args); va_end(args); fflush(stderr); } + +void (*xprintf)(const char *fmt, ...) = default_xprintf; void barf(const char *fmt, ...) { diff -r 88bb0d305308 -r f343d3c16dcc tools/xenstore/utils.h --- a/tools/xenstore/utils.h Wed Aug 01 15:47:54 2007 +0100 +++ b/tools/xenstore/utils.h Wed Aug 01 19:17:08 2007 +0100 @@ -24,7 +24,7 @@ void barf(const char *fmt, ...) __attrib void barf(const char *fmt, ...) __attribute__((noreturn)); void barf_perror(const char *fmt, ...) __attribute__((noreturn)); -void xprintf(const char *fmt, ...); +void (*xprintf)(const char *fmt, ...); #define eprintf(_fmt, _args...) xprintf("[ERR] %s" _fmt, __FUNCTION__, ##_args) diff -r 88bb0d305308 -r f343d3c16dcc tools/xenstore/xenstored_core.c --- a/tools/xenstore/xenstored_core.c Wed Aug 01 15:47:54 2007 +0100 +++ b/tools/xenstore/xenstored_core.c Wed Aug 01 19:17:08 2007 +0100 @@ -1883,11 +1883,7 @@ int main(int argc, char *argv[]) close(STDIN_FILENO); close(STDOUT_FILENO); close(STDERR_FILENO); - - /* Get ourselves a nice xenstored crash if these are used. */ - stdin = NULL; - stdout = NULL; - stderr = NULL; + xprintf = trace; /* xprintf() must not use stderr */ } signal(SIGHUP, trigger_reopen_log); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |