From 9f82d0bf8303cb5134cf51b0f8cda2eeb112fb22 Mon Sep 17 00:00:00 2001 From: Peter Lieven Date: Tue, 30 Oct 2012 11:47:12 +0100 Subject: [PATCH] INIT allow a trailing / in iscsi_parse_portal_url() --- lib/init.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/init.c b/lib/init.c index 278e20d..a534c3b 100644 --- a/lib/init.c +++ b/lib/init.c @@ -388,6 +388,8 @@ iscsi_parse_full_url(struct iscsi_context *iscsi, const char *url) } memset(iscsi_url, 0, sizeof(struct iscsi_url)); + + strncpy(iscsi_url->portal,portal,MAX_STRING_SIZE); strncpy(iscsi_url->target,target,MAX_STRING_SIZE); @@ -437,6 +439,9 @@ iscsi_parse_portal_url(struct iscsi_context *iscsi, const char *url) } } + tmp=strchr(portal,'/'); + if (tmp) *tmp=0; + iscsi_url = malloc(sizeof(struct iscsi_url)); if (iscsi_url == NULL) { iscsi_set_error(iscsi, "Out-of-memory: Failed to allocate iscsi_url structure");