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: Redirect stdin/stdout/stderr to

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xenstore: Redirect stdin/stdout/stderr to /dev/null.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 07 Aug 2007 05:30:09 -0700
Delivery-date: Tue, 07 Aug 2007 05:27:28 -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 1185993296 -3600
# Node ID 07364f8574b8fa9cb84d446c83fb13deee24fd81
# Parent  f343d3c16dccbe6215bddcd04a0524ab06b4cab0
xenstore: Redirect stdin/stdout/stderr to /dev/null.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 tools/xenstore/xenstored_core.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff -r f343d3c16dcc -r 07364f8574b8 tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c   Wed Aug 01 19:17:08 2007 +0100
+++ b/tools/xenstore/xenstored_core.c   Wed Aug 01 19:34:56 2007 +0100
@@ -1880,10 +1880,14 @@ int main(int argc, char *argv[])
 
        /* close stdin/stdout now we're ready to accept connections */
        if (dofork) {
-               close(STDIN_FILENO);
-               close(STDOUT_FILENO);
-               close(STDERR_FILENO);
-               xprintf = trace; /* xprintf() must not use stderr */
+               int devnull = open("/dev/null", O_RDWR);
+               if (devnull == -1)
+                       barf_perror("Could not open /dev/null\n");
+               close(STDIN_FILENO);  dup2(STDIN_FILENO, devnull);
+               close(STDOUT_FILENO); dup2(STDOUT_FILENO, devnull);
+               close(STDERR_FILENO); dup2(STDERR_FILENO, devnull);
+               close(devnull);
+               xprintf = trace;
        }
 
        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: Redirect stdin/stdout/stderr to /dev/null., Xen patchbot-unstable <=