diff options
author | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2007-08-01 19:17:08 +0100 |
---|---|---|
committer | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2007-08-01 19:17:08 +0100 |
commit | 79a18447fe70c67d682bcf585c2234efca25f46a (patch) | |
tree | 5910043d684fc863381f3c77a89f262630c5dcbb /tools | |
parent | 71b66d78933833d09538c903ded167636acf8a59 (diff) | |
download | xen-79a18447fe70c67d682bcf585c2234efca25f46a.tar.gz xen-79a18447fe70c67d682bcf585c2234efca25f46a.tar.bz2 xen-79a18447fe70c67d682bcf585c2234efca25f46a.zip |
xenstore: Do not assign to stdout/stderr/stdin - they are not
implemented as variables on all systems.
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/xenstore/utils.c | 7 | ||||
-rw-r--r-- | tools/xenstore/utils.h | 2 | ||||
-rw-r--r-- | tools/xenstore/xenstored_core.c | 6 |
3 files changed, 5 insertions, 10 deletions
diff --git a/tools/xenstore/utils.c b/tools/xenstore/utils.c index d7f5219a87..a1ac12584a 100644 --- a/tools/xenstore/utils.c +++ b/tools/xenstore/utils.c @@ -10,19 +10,18 @@ #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, ...) { char *str; diff --git a/tools/xenstore/utils.h b/tools/xenstore/utils.h index ce14f3a408..f378343707 100644 --- a/tools/xenstore/utils.h +++ b/tools/xenstore/utils.h @@ -24,7 +24,7 @@ static inline bool strends(const char *a, const char *b) 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 --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c index fc3171f14b..a969bcff56 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -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); |