diff --git a/xen-warnings.diff b/xen-warnings.diff index 0a7a57e..92db13b 100644 --- a/xen-warnings.diff +++ b/xen-warnings.diff @@ -78,7 +78,52 @@ Index: xen-3.1-testing/tools/blktap/drivers/blktapctrl.c =================================================================== --- xen-3.1-testing.orig/tools/blktap/drivers/blktapctrl.c +++ xen-3.1-testing/tools/blktap/drivers/blktapctrl.c -@@ -678,7 +678,10 @@ int main(int argc, char *argv[]) +@@ -143,7 +143,8 @@ static int get_new_dev(int *major, int * + return -1; + } + +- asprintf(&devname,"%s/%s%d",BLKTAP_DEV_DIR, BLKTAP_DEV_NAME, *minor); ++ if (asprintf(&devname,"%s/%s%d",BLKTAP_DEV_DIR, BLKTAP_DEV_NAME, *minor) == -1) ++ return -1; + make_blktap_dev(devname,*major,*minor); + DPRINTF("Received device id %d and major %d, " + "sent domid %d and be_id %d\n", +@@ -495,20 +496,27 @@ int blktapctrl_new_blkif(blkif_t *blkif) + + if (!exist) { + DPRINTF("Process does not exist:\n"); +- asprintf(&rdctldev, +- "%s/tapctrlread%d", BLKTAP_CTRL_DIR, minor); +- blkif->fds[READ] = open_ctrl_socket(rdctldev); +- ++ if (asprintf(&rdctldev, ++ "%s/tapctrlread%d", BLKTAP_CTRL_DIR, minor) == -1) ++ return -1; ++ if (asprintf(&wrctldev, ++ "%s/tapctrlwrite%d", BLKTAP_CTRL_DIR, minor) == -1) { ++ free(rdctldev); ++ return -1; ++ } ++ if (asprintf(&cmd, "tapdisk %s %s", wrctldev, rdctldev) == -1) { ++ free(rdctldev); ++ free(wrctldev); ++ return -1; ++ } + +- asprintf(&wrctldev, +- "%s/tapctrlwrite%d", BLKTAP_CTRL_DIR, minor); ++ blkif->fds[READ] = open_ctrl_socket(rdctldev); + blkif->fds[WRITE] = open_ctrl_socket(wrctldev); + + if (blkif->fds[READ] == -1 || blkif->fds[WRITE] == -1) + goto fail; + + /*launch the new process*/ +- asprintf(&cmd, "tapdisk %s %s", wrctldev, rdctldev); + DPRINTF("Launching process, CMDLINE [%s]\n",cmd); + if (system(cmd) == -1) { + DPRINTF("Unable to fork, cmdline: [%s]\n",cmd); +@@ -678,7 +686,10 @@ int main(int argc, char *argv[]) __init_blkif(); snprintf(buf, sizeof(buf), "BLKTAPCTRL[%d]", getpid()); openlog(buf, LOG_CONS|LOG_ODELAY, LOG_DAEMON); @@ -90,6 +135,16 @@ Index: xen-3.1-testing/tools/blktap/drivers/blktapctrl.c print_drivers(); init_driver_list(); +@@ -689,7 +700,8 @@ int main(int argc, char *argv[]) + register_new_unmap_hook(unmap_blktapctrl); + + /* Attach to blktap0 */ +- asprintf(&devname,"%s/%s0", BLKTAP_DEV_DIR, BLKTAP_DEV_NAME); ++ if (asprintf(&devname,"%s/%s0", BLKTAP_DEV_DIR, BLKTAP_DEV_NAME) == -1) ++ goto open_failed; + if ((ret = xc_find_device_number("blktap0")) < 0) + goto open_failed; + blktap_major = major(ret); Index: xen-3.1-testing/tools/blktap/drivers/block-vmdk.c =================================================================== --- xen-3.1-testing.orig/tools/blktap/drivers/block-vmdk.c @@ -100,7 +155,7 @@ Index: xen-3.1-testing/tools/blktap/drivers/block-vmdk.c cluster_offset = lseek(prv->fd, 0, SEEK_END); - ftruncate(prv->fd, cluster_offset + - (prv->cluster_sectors << 9)); -+ if (ftruncate(prv->fd, cluster_offset + ++ if (ftruncate(prv->fd, cluster_offset + + (prv->cluster_sectors << 9))) + return 0; cluster_offset >>= 9; @@ -122,7 +177,19 @@ Index: xen-3.1-testing/tools/blktap/drivers/block-qcow.c free(tmp_ptr2); } return cluster_offset; -@@ -1162,7 +1165,7 @@ int tdqcow_close(struct disk_driver *dd) +@@ -868,7 +871,10 @@ int tdqcow_open (struct disk_driver *dd, + } + + s->fd = fd; +- asprintf(&s->name,"%s", name); ++ if (asprintf(&s->name,"%s", name) == -1) { ++ close(fd); ++ return -1; ++ } + + ASSERT(sizeof(QCowHeader) + sizeof(QCowHeader_ext) < 512); + +@@ -1162,7 +1168,7 @@ int tdqcow_close(struct disk_driver *dd) offset = sizeof(QCowHeader) + sizeof(uint32_t); lseek(fd, offset, SEEK_SET); out = cpu_to_be32(cksum); @@ -131,7 +198,7 @@ Index: xen-3.1-testing/tools/blktap/drivers/block-qcow.c close(fd); } -@@ -1252,8 +1255,8 @@ int qcow_create(const char *filename, ui +@@ -1252,8 +1258,8 @@ int qcow_create(const char *filename, ui strncpy(backing_filename, backing_file, sizeof(backing_filename)); } else { @@ -192,3 +259,144 @@ Index: xen-3.1-testing/tools/xenstore/utils.c exit(1); } +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 + void *result = va_arg(ap, void *); + char *p; + +- asprintf(&path, "%s/%s", dir, name); ++ success = asprintf(&path, "%s/%s", dir, name) != -1; ++ if (!success) { ++ ret = ENOMEM; ++ break; ++ } + p = xs_read(xs, XBT_NULL, path, NULL); + free(path); + if (p == NULL) { +Index: xen-3.1-testing/tools/blktap/lib/xenbus.c +=================================================================== +--- xen-3.1-testing.orig/tools/blktap/lib/xenbus.c ++++ xen-3.1-testing/tools/blktap/lib/xenbus.c +@@ -360,8 +360,7 @@ int add_blockdevice_probe_watch(struct x + char *path; + struct xenbus_watch *vbd_watch; + +- asprintf(&path, "/local/domain/%s/backend/tap", domid); +- if (path == NULL) ++ if (asprintf(&path, "/local/domain/%s/backend/tap", domid) == -1) + return -ENOMEM; + + vbd_watch = (struct xenbus_watch *)malloc(sizeof(struct xenbus_watch)); +@@ -399,8 +398,7 @@ int watch_for_domid(struct xs_handle *h) + struct xenbus_watch *domid_watch; + char *path = NULL; + +- asprintf(&path, "/local/domain"); +- if (path == NULL) ++ if (asprintf(&path, "/local/domain") == -1) + return -ENOMEM; + + domid_watch = malloc(sizeof(struct xenbus_watch)); +Index: xen-3.1-testing/tools/blktap/lib/xs_api.c +=================================================================== +--- xen-3.1-testing.orig/tools/blktap/lib/xs_api.c ++++ xen-3.1-testing/tools/blktap/lib/xs_api.c +@@ -126,10 +126,12 @@ int xs_printf(struct xs_handle *h, const + ret = vasprintf(&buf, fmt, ap); + va_end(ap); + +- asprintf(&path, "%s/%s", dir, node); +- +- if ((path == NULL) || (buf == NULL)) ++ if (ret == -1) ++ return 0; ++ if (asprintf(&path, "%s/%s", dir, node) == -1) { ++ free(buf); + return 0; ++ } + + 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; + + 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; + val = xs_read(h, xth, path, &len); + free(path); + if (val == NULL) +@@ -191,7 +194,10 @@ 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; ++ } + domid = xs_read(h, xth, path, &len); + free(path); + } +@@ -204,16 +210,14 @@ char *get_dom_domid(struct xs_handle *h) + } + + int convert_dev_name_to_num(char *name) { +- char *p_sd, *p_hd, *p_xvd, *p_plx, *p, *alpha,*ptr; ++ char *p, *ptr; + int majors[10] = {3,22,33,34,56,57,88,89,90,91}; + int maj,i,ret = 0; +- +- asprintf(&p_sd,"/dev/sd"); +- asprintf(&p_hd,"/dev/hd"); +- asprintf(&p_xvd,"/dev/xvd"); +- asprintf(&p_plx,"plx"); +- asprintf(&alpha,"abcdefghijklmnop"); +- ++ char *p_sd = "/dev/sd"; ++ char *p_hd = "/dev/hd"; ++ char *p_xvd = "/dev/xvd"; ++ char *p_plx = "plx"; ++ char *alpha = "abcdefghijklmnop"; + + if (strstr(name, p_sd) != NULL) { + p = name + strlen(p_sd); +@@ -251,12 +255,6 @@ int convert_dev_name_to_num(char *name) + ret = BASE_DEV_VAL; + } + +- free(p_sd); +- free(p_hd); +- free(p_xvd); +- free(p_plx); +- free(alpha); +- + return ret; + } + +Index: xen-3.1-testing/tools/blktap/drivers/tapdisk.c +=================================================================== +--- xen-3.1-testing.orig/tools/blktap/drivers/tapdisk.c ++++ xen-3.1-testing/tools/blktap/drivers/tapdisk.c +@@ -220,7 +220,8 @@ static int map_new_dev(struct td_state * + fd_list_entry_t *ptr; + int page_size; + +- asprintf(&devname,"%s/%s%d", BLKTAP_DEV_DIR, BLKTAP_DEV_NAME, minor); ++ if (asprintf(&devname,"%s/%s%d", BLKTAP_DEV_DIR, BLKTAP_DEV_NAME, minor) == -1) ++ return -1; + tap_fd = open(devname, O_RDWR); + if (tap_fd == -1) + { diff --git a/xen.changes b/xen.changes index 1590ebf..83cc9b9 100644 --- a/xen.changes +++ b/xen.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Jun 11 10:11:00 MDT 2007 - ccoffing@novell.com + +- Fix more warn_unused_value compiler warnings. + ------------------------------------------------------------------- Fri Jun 8 12:11:42 MDT 2007 - ccoffing@novell.com diff --git a/xen.spec b/xen.spec index 1c55b58..393a2c4 100644 --- a/xen.spec +++ b/xen.spec @@ -35,7 +35,7 @@ BuildRequires: glibc-32bit glibc-devel-32bit BuildRequires: kernel-source kernel-syms xorg-x11 %endif Version: 3.1.0_15042 -Release: 1 +Release: 2 License: GNU General Public License (GPL) Group: System/Kernel Autoreqprov: on @@ -924,6 +924,8 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info /sbin/ldconfig %changelog +* Mon Jun 11 2007 - ccoffing@novell.com +- Fix more warn_unused_value compiler warnings. * Fri Jun 08 2007 - ccoffing@novell.com - Update to official rc10 (changeset 15042). - Updated vm-install: