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] xentop crash fix

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] xentop crash fix
From: John Levon <levon@xxxxxxxxxxxxxxxxx>
Date: 2006年10月17日 14:25:54 +0100
Delivery-date: 2006年10月17日 06:26:26 -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
# HG changeset patch
# User john.levon@xxxxxxx
# Date 1161091503 25200
# Node ID e11d992700d1fe4ad7e761ad8d383ad4049c40b9
# Parent 3c79fe20116bccea65a7d455590bea6331d27d6f
It's not correct to call endwin() if initscr() fails, and it crashes older
libcurses implementations.
Signed-off-by: John Levon <john.levon@xxxxxxx>
diff --git a/tools/xenstat/xentop/xentop.c b/tools/xenstat/xentop/xentop.c
--- a/tools/xenstat/xentop/xentop.c
+++ b/tools/xenstat/xentop/xentop.c
@@ -189,6 +189,8 @@ int prompt_val_len = 0;
 int prompt_val_len = 0;
 void (*prompt_complete_func)(char *);
 
+static WINDOW *cwin;
+
 /*
 * Function definitions
 */
@@ -225,7 +227,7 @@ static void version(void)
 /* Clean up any open resources */
 static void cleanup(void)
 {
- if(!isendwin())
+ if(cwin != NULL && !isendwin())
 endwin();
 if(prev_node != NULL)
 xenstat_free_node(prev_node);
@@ -238,7 +240,7 @@ static void cleanup(void)
 /* Display the given message and gracefully exit */
 static void fail(const char *str)
 {
- if(!isendwin())
+ if(cwin != NULL && !isendwin())
 endwin();
 fprintf(stderr, str);
 exit(1);
@@ -1039,7 +1041,7 @@ int main(int argc, char **argv)
 
 if (!batch) {
 /* Begin curses stuff */
- initscr();
+ cwin = initscr();
 start_color();
 cbreak();
 noecho();
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] xentop crash fix, John Levon <=
Previous by Date: [Xen-devel] [PATCH] Fix multiple inclusion when building libxenguest. , John Levon
Next by Date: Re: [Xen-devel] [PATCH][HVM] fix PCI interrupt routing via ACPI , Dave Lively
Previous by Thread: [Xen-devel] [PATCH] Fix multiple inclusion when building libxenguest. , John Levon
Next by Thread: [Xen-devel] [PATCH] compile fix for RING_HAS_UNCONSUMED_REQUESTS , John Levon
Indexes: [Date] [Thread] [Top] [All Lists]

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

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