ia64/xen-unstable

changeset 11289:ba3061912d3d

Ensure get_dom_domid() terminates even when /local/domain/<foo>/name is
not present.

Signed-off-by: Steven Hand <steven@xensource.com>
author Steven Hand <steven@xensource.com>
date Thu Aug 24 14:07:01 2006 +0100 (2006-08-24)
parents 1ff4cc298bec
children d5eb5205ff35
files tools/blktap/lib/xs_api.c
line diff
     1.1 --- a/tools/blktap/lib/xs_api.c	Thu Aug 24 09:49:41 2006 +0100
     1.2 +++ b/tools/blktap/lib/xs_api.c	Thu Aug 24 14:07:01 2006 +0100
     1.3 @@ -180,8 +180,7 @@ char *get_dom_domid(struct xs_handle *h,
     1.4  	
     1.5  	e = xs_directory(h, xth, "/local/domain", &num);
     1.6  	
     1.7 -	i = 0;
     1.8 -	while (i < num) {
     1.9 +	for (i = 0; (i < num) && (domid == NULL); i++) {
    1.10  		asprintf(&path, "/local/domain/%s/name", e[i]);
    1.11  		val = xs_read(h, xth, path, &len);
    1.12  		free(path);
    1.13 @@ -192,12 +191,9 @@ char *get_dom_domid(struct xs_handle *h,
    1.14  			/* match! */
    1.15  			asprintf(&path, "/local/domain/%s/domid", e[i]);
    1.16  			domid = xs_read(h, xth, path, &len);
    1.17 -			free(val);
    1.18  			free(path);
    1.19 -			break;
    1.20  		}
    1.21  		free(val);
    1.22 -		i++;
    1.23  	}
    1.24  	xs_transaction_end(h, xth, 0);
    1.25