Commit 809dc418 authored by Paul Luse's avatar Paul Luse Committed by Jim Harris
Browse files

blobcli: fixup error handling in dump_imp_open_cb()



Change-Id: Ia7feebd39a023642b94bedbab4da8f3b2f09b245
Signed-off-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-on: https://review.gerrithub.io/382904


Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent e9a50eb8
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -683,8 +683,8 @@ dump_imp_open_cb(void *cb_arg, struct spdk_blob *blob, int bserrno)
	cli_context->buff = spdk_dma_malloc(cli_context->page_size,
					    ALIGN_4K, NULL);
	if (cli_context->buff == NULL) {
		unload_bs(cli_context, "Error in allocating memory",
			  -ENOMEM);
		printf("Error in allocating memory\n");
		spdk_bs_md_close_blob(&cli_context->blob, close_cb, cli_context);
		return;
	}
	printf("Working");
@@ -692,6 +692,11 @@ dump_imp_open_cb(void *cb_arg, struct spdk_blob *blob, int bserrno)
	cli_context->page_count = 0;
	if (cli_context->action == CLI_DUMP) {
		cli_context->fp = fopen(cli_context->file, "w");
		if (cli_context->fp == NULL) {
			printf("Error in opening file\n");
			spdk_bs_md_close_blob(&cli_context->blob, close_cb, cli_context);
			return;
		}

		/* read a page of data from the blob */
		spdk_bs_io_read_blob(cli_context->blob, cli_context->channel,
@@ -699,6 +704,11 @@ dump_imp_open_cb(void *cb_arg, struct spdk_blob *blob, int bserrno)
				     NUM_PAGES, read_dump_cb, cli_context);
	} else {
		cli_context->fp = fopen(cli_context->file, "r");
		if (cli_context->fp == NULL) {
			printf("Error in opening file\n");
			spdk_bs_md_close_blob(&cli_context->blob, close_cb, cli_context);
			return;
		}

		/* get the filesize then rewind read a page of data from file */
		fseek(cli_context->fp, 0L, SEEK_END);