WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] xenstore: Do not assign to stdout/stderr/

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xenstore: Do not assign to stdout/stderr/stdin - they are not
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 07 Aug 2007 05:30:07 -0700
Delivery-date: Tue, 07 Aug 2007 05:27:24 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xenstore: Do not assign to stdout/stderr/stdin - they are not, Xen patchbot-unstable <=