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

xen-devel

[Top] [All Lists]

[Xen-devel] [PATCH] fix xenstored's dup2() usage

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] fix xenstored's dup2() usage
From: John Levon <levon@xxxxxxxxxxxxxxxxx>
Date: Wed, 5 Sep 2007 16:39:23 +0100
Delivery-date: 2007年9月05日 08:47:07 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.9i
The dup2() calls had their arguments reversed. Also remove the
unnecessary close() calls.
Signed-off-by: John Levon <john.levon@xxxxxxx>
diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -1952,14 +1952,14 @@ int main(int argc, char *argv[])
 fflush(stdout);
 }
 
- /* close stdin/stdout now we're ready to accept connections */
+ /* redirect to /dev/null now we're ready to accept connections */
 if (dofork) {
 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);
+ dup2(devnull, STDIN_FILENO);
+ dup2(devnull, STDOUT_FILENO);
+ dup2(devnull, STDERR_FILENO);
 close(devnull);
 xprintf = trace;
 }
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] fix xenstored's dup2() usage, John Levon <=
Previous by Date: [Xen-devel] which version of xen supports intel trusted execution technology , 0261004
Next by Date: [Xen-devel] [PATCH] xc_map_foreign_pages(), a convenient alternative to xc_map_foreign_batch() , Markus Armbruster
Previous by Thread: [Xen-devel] which version of xen supports intel trusted execution technology , 0261004
Next by Thread: [Xen-devel] [PATCH] xc_map_foreign_pages(), a convenient alternative to xc_map_foreign_batch() , Markus Armbruster
Indexes: [Date] [Thread] [Top] [All Lists]

Copyright ©, Citrix Systems Inc. All rights reserved. Legal and Privacy
Citrix This site is hosted by Citrix

AltStyle によって変換されたページ (->オリジナル) /