diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/xenstore/utils.c | 11 | ||||
-rw-r--r-- | tools/xenstore/xenstored_core.c | 9 | ||||
-rw-r--r-- | tools/xenstore/xenstored_domain.c | 9 | ||||
-rw-r--r-- | tools/xenstore/xs_tdb_dump.c | 2 |
4 files changed, 16 insertions, 15 deletions
diff --git a/tools/xenstore/utils.c b/tools/xenstore/utils.c index 45e71efd14..d7f5219a87 100644 --- a/tools/xenstore/utils.c +++ b/tools/xenstore/utils.c @@ -8,20 +8,19 @@ #include <fcntl.h> #include <sys/types.h> #include <signal.h> - #include "utils.h" void xprintf(const char *fmt, ...) { - static FILE *out = NULL; va_list args; - if (!out) - out = stderr; + + if (!stderr) + return; /* could trace()? */ va_start(args, fmt); - vfprintf(out, fmt, args); + vfprintf(stderr, fmt, args); va_end(args); - fflush(out); + fflush(stderr); } void barf(const char *fmt, ...) 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); diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c index d166c0556e..ed422a52aa 100644 --- a/tools/xenstore/xenstored_domain.c +++ b/tools/xenstore/xenstored_domain.c @@ -621,13 +621,8 @@ void domain_entry_fix(unsigned int domid, int num) struct domain *d; d = find_domain_by_domid(domid); - if (d) { - if ((d->nbentry += num) < 0) { - eprintf("invalid domain entry number %d", - d->nbentry); - d->nbentry = 0; - } - } + if (d && ((d->nbentry += num) < 0)) + d->nbentry = 0; } int domain_entry(struct connection *conn) diff --git a/tools/xenstore/xs_tdb_dump.c b/tools/xenstore/xs_tdb_dump.c index 5f1382f41b..d3c515418c 100644 --- a/tools/xenstore/xs_tdb_dump.c +++ b/tools/xenstore/xs_tdb_dump.c @@ -4,7 +4,7 @@ #include <fcntl.h> #include <stdio.h> #include <stdarg.h> - +#include <string.h> #include "xs_lib.h" #include "tdb.h" #include "talloc.h" |