init: use strerror when conf file can't be loaded

This makes it more clear why reading a JSON
configuration file failed.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I9dae907c839d48068044b09f34b89a2de51cd811
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10057
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Jim Harris 2021-10-28 21:38:04 +00:00
parent ec2ad00c92
commit 92d31eb226

View File

@ -41,6 +41,7 @@
#include "spdk/thread.h"
#include "spdk/jsonrpc.h"
#include "spdk/rpc.h"
#include "spdk/string.h"
#include "spdk_internal/event.h"
@ -528,7 +529,8 @@ app_json_config_read(const char *config_file, struct load_json_config_ctx *ctx)
json = read_file(config_file, &json_size);
if (!json) {
SPDK_ERRLOG("Read JSON configuration file %s failed\n", config_file);
SPDK_ERRLOG("Read JSON configuration file %s failed: %s\n",
config_file, spdk_strerror(errno));
return -errno;
}