mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
blktap: Fix compile errors
When compiling the various blktap drivers with warnings cranked up, I get errors that return values are not checked. Signed-off-by: Charles Coffing <ccoffing@novell.com>
This commit is contained in:
1 parent
1c77b7cb9f
commit
ecc82ca3e6
3 files changed
+13
-6
No files matched your search
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
@@ -1252,8 +1255,8 @@ int qcow_create(const char *filename, uint64_t total_size,
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,8 +283,9 @@ static uint64_t get_cluster_offset(struct tdvmdk_state *prv,
|
||||
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);
|
||||
|
||||