Index: xen-3.1-testing/tools/ioemu/hw/piix4acpi.c =================================================================== --- xen-3.1-testing.orig/tools/ioemu/hw/piix4acpi.c +++ xen-3.1-testing/tools/ioemu/hw/piix4acpi.c @@ -69,6 +69,8 @@ static int piix4acpi_load(QEMUFile *f, v if (version_id > 1) return -EINVAL; qemu_get_be16s(f, &s->pm1_control); + + return 0; } static void acpiPm1Control_writeb(void *opaque, uint32_t addr, uint32_t val) Index: xen-3.1-testing/tools/ioemu/hw/usb-hid.c =================================================================== --- xen-3.1-testing.orig/tools/ioemu/hw/usb-hid.c +++ xen-3.1-testing/tools/ioemu/hw/usb-hid.c @@ -557,6 +557,7 @@ int usb_mouse_load(QEMUFile *f, void *op fprintf(logfile, "usb_mouse_load:add usb_mouse_event.\n"); qemu_add_mouse_event_handler(usb_mouse_event, s, 0); } + return 0; } Index: xen-3.1-testing/tools/misc/miniterm/miniterm.c =================================================================== --- xen-3.1-testing.orig/tools/misc/miniterm/miniterm.c +++ xen-3.1-testing/tools/misc/miniterm/miniterm.c @@ -157,7 +157,7 @@ int main(int argc, char **argv) case 0: close(1); /* stdout not needed */ for ( c = (char)getchar(); c != ENDMINITERM; c = (char)getchar() ) - write(fd,&c,1); + if (write(fd,&c,1)) ; tcsetattr(fd,TCSANOW,&oldsertio); tcsetattr(0,TCSANOW,&oldstdtio); close(fd); @@ -169,19 +169,19 @@ int main(int argc, char **argv) close(fd); exit(-1); default: - write(1, start_str, strlen(start_str)); + if (write(1, start_str, strlen(start_str))) ; close(0); /* stdin not needed */ sa.sa_handler = child_handler; sa.sa_flags = 0; sigaction(SIGCHLD,&sa,NULL); /* handle dying child */ while ( !stop ) { - read(fd,&c,1); /* modem */ + if (read(fd,&c,1)) ; /* modem */ c = (char)c; - write(1,&c,1); /* stdout */ + if (write(1,&c,1)) ; /* stdout */ } wait(NULL); /* wait for child to die or it will become a zombie */ - write(1, end_str, strlen(end_str)); + if (write(1, end_str, strlen(end_str))) ; break; } Index: xen-3.1-testing/xen/tools/symbols.c =================================================================== --- xen-3.1-testing.orig/xen/tools/symbols.c +++ xen-3.1-testing/xen/tools/symbols.c @@ -80,7 +80,8 @@ static int read_symbol(FILE *in, struct if (rc != 3) { if (rc != EOF) { /* skip line */ - fgets(str, 500, in); + if (fgets(str, sizeof(str), in) == NULL) + ; /* don't care */ } return -1; } 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[]) __init_blkif(); snprintf(buf, sizeof(buf), "BLKTAPCTRL[%d]", getpid()); openlog(buf, LOG_CONS|LOG_ODELAY, LOG_DAEMON); - daemon(0,0); + if (daemon(0,0)) { + DPRINTF("daemon failed (%d)\n", errno); + goto open_failed; + } print_drivers(); init_driver_list(); Index: xen-3.1-testing/tools/blktap/drivers/block-vmdk.c =================================================================== --- xen-3.1-testing.orig/tools/blktap/drivers/block-vmdk.c +++ xen-3.1-testing/tools/blktap/drivers/block-vmdk.c @@ -283,8 +283,9 @@ static uint64_t get_cluster_offset(struc if (!allocate) return 0; cluster_offset = lseek(prv->fd, 0, SEEK_END); - ftruncate(prv->fd, cluster_offset + - (prv->cluster_sectors << 9)); + if (ftruncate(prv->fd, cluster_offset + + (prv->cluster_sectors << 9))) + return 0; cluster_offset >>= 9; /* update L2 table */ tmp = cpu_to_le32(cluster_offset); Index: xen-3.1-testing/tools/blktap/drivers/block-qcow.c =================================================================== --- xen-3.1-testing.orig/tools/blktap/drivers/block-qcow.c +++ xen-3.1-testing/tools/blktap/drivers/block-qcow.c @@ -745,7 +745,10 @@ found: } memcpy(tmp_ptr2, l2_ptr, 4096); lseek(s->fd, l2_offset + (l2_sector << 12), SEEK_SET); - write(s->fd, tmp_ptr2, 4096); + if (write(s->fd, tmp_ptr2, 4096) != 4096) { + free(tmp_ptr2); + return -1; + } free(tmp_ptr2); } return cluster_offset; @@ -1162,7 +1165,7 @@ int tdqcow_close(struct disk_driver *dd) offset = sizeof(QCowHeader) + sizeof(uint32_t); lseek(fd, offset, SEEK_SET); out = cpu_to_be32(cksum); - write(fd, &out, sizeof(uint32_t)); + if (write(fd, &out, sizeof(uint32_t))) ; close(fd); } @@ -1252,8 +1255,8 @@ int qcow_create(const char *filename, ui strncpy(backing_filename, backing_file, sizeof(backing_filename)); } else { - realpath(backing_file, backing_filename); - if (stat(backing_filename, &st) != 0) { + if (realpath(backing_file, backing_filename) == NULL || + stat(backing_filename, &st) != 0) { return -1; } }