SHA256
1
0
forked from pool/xen
OBS User unknown 2007-06-11 23:14:58 +00:00 committed by Git OBS Bridge
parent 2984ee2c3e
commit 013cf62680
2 changed files with 25 additions and 21 deletions

View File

@ -263,21 +263,12 @@ Index: xen-3.1-testing/tools/console/daemon/io.c
===================================================================
--- xen-3.1-testing.orig/tools/console/daemon/io.c
+++ xen-3.1-testing/tools/console/daemon/io.c
@@ -226,6 +226,7 @@ int xs_gather(struct xs_handle *xs, cons
const char *name;
char *path;
int ret = 0;
+ bool success;
va_start(ap, dir);
while (ret == 0 && (name = va_arg(ap, char *)) != NULL) {
@@ -233,7 +234,11 @@ int xs_gather(struct xs_handle *xs, cons
@@ -233,7 +233,10 @@ int xs_gather(struct xs_handle *xs, cons
void *result = va_arg(ap, void *);
char *p;
- asprintf(&path, "%s/%s", dir, name);
+ success = asprintf(&path, "%s/%s", dir, name) != -1;
+ if (!success) {
+ if (asprintf(&path, "%s/%s", dir, name) == -1) {
+ ret = ENOMEM;
+ break;
+ }
@ -319,38 +310,51 @@ Index: xen-3.1-testing/tools/blktap/lib/xs_api.c
- asprintf(&path, "%s/%s", dir, node);
-
- if ((path == NULL) || (buf == NULL))
- return 0;
+ if (ret == -1)
+ return 0;
+ return ENOMEM;
+ if (asprintf(&path, "%s/%s", dir, node) == -1) {
+ free(buf);
return 0;
+ return ENOMEM;
+ }
ret = xs_write(h, XBT_NULL, path, buf, strlen(buf)+1);
@@ -183,7 +185,8 @@ char *get_dom_domid(struct xs_handle *h)
return NULL;
@@ -180,10 +182,11 @@ char *get_dom_domid(struct xs_handle *h)
e = xs_directory(h, xth, "/local/domain", &num);
if (e == NULL)
- return NULL;
+ goto done;
for (i = 0; (i < num) && (domid == NULL); i++) {
- asprintf(&path, "/local/domain/%s/name", e[i]);
+ if (asprintf(&path, "/local/domain/%s/name", e[i]) == -1)
+ return NULL;
+ break;
val = xs_read(h, xth, path, &len);
free(path);
if (val == NULL)
@@ -191,7 +194,10 @@ char *get_dom_domid(struct xs_handle *h)
@@ -191,29 +194,31 @@ char *get_dom_domid(struct xs_handle *h)
if (strcmp(val, DOMNAME) == 0) {
/* match! */
- asprintf(&path, "/local/domain/%s/domid", e[i]);
+ if (asprintf(&path, "/local/domain/%s/domid", e[i]) == -1) {
+ free(val);
+ return NULL;
+ break;
+ }
domid = xs_read(h, xth, path, &len);
free(path);
}
@@ -204,16 +210,14 @@ char *get_dom_domid(struct xs_handle *h)
free(val);
}
+done:
xs_transaction_end(h, xth, 0);
-
- free(e);
+ if (e)
+ free(e);
return domid;
}
int convert_dev_name_to_num(char *name) {
@ -373,7 +377,7 @@ Index: xen-3.1-testing/tools/blktap/lib/xs_api.c
if (strstr(name, p_sd) != NULL) {
p = name + strlen(p_sd);
@@ -251,12 +255,6 @@ int convert_dev_name_to_num(char *name)
@@ -251,12 +256,6 @@ int convert_dev_name_to_num(char *name)
ret = BASE_DEV_VAL;
}

View File

@ -35,7 +35,7 @@ BuildRequires: glibc-32bit glibc-devel-32bit
BuildRequires: kernel-source kernel-syms xorg-x11
%endif
Version: 3.1.0_15042
Release: 2
Release: 3
License: GNU General Public License (GPL)
Group: System/Kernel
Autoreqprov: on