From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerone Young Subject: [PATCH] Fix random segfaults in with xm top Date: Wed, 23 Nov 2005 12:18:32 -0600 Message-ID: <1132769913.3868.7.camel@laptop> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-CD1b3yaU5q50mYx0tqoC" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel List-Id: xen-devel@lists.xenproject.org --=-CD1b3yaU5q50mYx0tqoC Content-Type: text/plain Content-Transfer-Encoding: 7bit This fixes a small race between when a domain is created and when xentop tries to read it's info from the xenstore. Instead of sending a NULL pointer for the name the name will be displayed as a ' ' until the next refresh where xentop will then properly display the name. Signed-off-by: Jerone Young --=-CD1b3yaU5q50mYx0tqoC Content-Disposition: attachment; filename=xenstat_fix.diff Content-Type: text/x-patch; name=xenstat_fix.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit # HG changeset patch # User root@leaf1 # Node ID 7ce2dfd820e39c7764f276a785415014a7954861 # Parent 14d733e5e1d014e302d72fb78df1428ee08e3ce3 * fix random segfaults in xentop by never returning null * remove xenstore transcations (not needed). diff -r 14d733e5e1d0 -r 7ce2dfd820e3 tools/xenstat/libxenstat/src/xenstat.c --- a/tools/xenstat/libxenstat/src/xenstat.c Wed Nov 23 13:15:35 2005 +++ b/tools/xenstat/libxenstat/src/xenstat.c Wed Nov 23 19:17:11 2005 @@ -702,19 +702,16 @@ { char path[80]; char *name; - struct xs_transaction_handle *xstranshandle; snprintf(path, sizeof(path),"/local/domain/%i/name", domain_id); - xstranshandle = xs_transaction_start(handle->xshandle); - if (xstranshandle == NULL) { - perror("Unable to get transcation handle from xenstore\n"); - exit(1); /* Change this */ - } - - name = (char *) xs_read(handle->xshandle, xstranshandle, path, NULL); + name = (char *) xs_read(handle->xshandle, NULL, path, NULL); - xs_transaction_end(handle->xshandle, xstranshandle, false); + if (name == NULL) + { + name = (char *)malloc((size_t)sizeof(char)); + name[0] = ' '; + } return name; } --=-CD1b3yaU5q50mYx0tqoC Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-CD1b3yaU5q50mYx0tqoC--