MEMORY add compatibility for qemu-kvm

qemu-kvm iscsi block driver calls iscsi_parse_full_url without
a valid iscsi_context. The driver also creates its own scsi_task
objects.
This commit is contained in:
Peter Lieven
2012-11-03 02:05:16 +01:00
parent 7f98233169
commit 871c56ce7a
4 changed files with 35 additions and 14 deletions

View File

@@ -140,7 +140,8 @@ iscsi_full_connect_async(struct iscsi_context *iscsi, const char *portal,
struct connect_task *ct;
iscsi->lun = lun;
strncpy(iscsi->portal,portal,MAX_STRING_SIZE);
if (iscsi->portal != portal)
strncpy(iscsi->portal,portal,MAX_STRING_SIZE);
ct = iscsi_malloc(iscsi, sizeof(struct connect_task));
if (ct == NULL) {
@@ -326,14 +327,13 @@ try_again:
close(iscsi->fd);
iscsi->fd = old_iscsi->fd;
int _mallocs = old_iscsi->mallocs;
int _frees = old_iscsi->frees;
iscsi->mallocs+=old_iscsi->mallocs;
iscsi->frees+=old_iscsi->frees;
memcpy(old_iscsi, iscsi, sizeof(struct iscsi_context));
free(iscsi);
old_iscsi->is_reconnecting = 0;
old_iscsi->mallocs+=_mallocs;
old_iscsi->frees+=_frees;
return 0;
}