aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenstore/xenstored_core.c
diff options
context:
space:
mode:
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-08-01 12:55:10 +0100
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-08-01 12:55:10 +0100
commitb1757490f0d13d1525e9d6a589188ddf4acafbbf (patch)
tree49528945fffde6c92ddfefa5bafd852e04a09ba9 /tools/xenstore/xenstored_core.c
parent019e22bb40852a517dd5b678dba6ef660c606a15 (diff)
downloadxen-b1757490f0d13d1525e9d6a589188ddf4acafbbf.tar.gz
xen-b1757490f0d13d1525e9d6a589188ddf4acafbbf.tar.bz2
xen-b1757490f0d13d1525e9d6a589188ddf4acafbbf.zip
xenstored: Do not write to stderr if we are daemonised!
This fixes client reader-thread deaths in which a 'garbage string' was being read instead of a well-formed message header. Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'tools/xenstore/xenstored_core.c')
-rw-r--r--tools/xenstore/xenstored_core.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index f34a698cb4..fc3171f14b 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -1820,7 +1820,9 @@ int main(int argc, char *argv[])
if (pidfile)
write_pidfile(pidfile);
- talloc_enable_leak_report_full();
+ /* Talloc leak reports go to stderr, which is closed if we fork. */
+ if (!dofork)
+ talloc_enable_leak_report_full();
/* Create sockets for them to listen to. */
sock = talloc(talloc_autofree_context(), int);
@@ -1881,6 +1883,11 @@ 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;
}
signal(SIGHUP, trigger_reopen_log);