blobcli: fixup error handling in dump_imp_open_cb()
Change-Id: Ia7feebd39a023642b94bedbab4da8f3b2f09b245 Signed-off-by: Paul Luse <paul.e.luse@intel.com> Reviewed-on: https://review.gerrithub.io/382904 Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
e9a50eb8cc
commit
809dc4187e
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user