From 92d31eb226b15e319fec3bfbbcb45d8fba82125e Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Thu, 28 Oct 2021 21:38:04 +0000 Subject: [PATCH] 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 Change-Id: I9dae907c839d48068044b09f34b89a2de51cd811 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10057 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Changpeng Liu --- lib/init/json_config.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/init/json_config.c b/lib/init/json_config.c index 6305af4fc..8a548ac64 100644 --- a/lib/init/json_config.c +++ b/lib/init/json_config.c @@ -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; }