From df67486fa953514b55b387a48612b8f3a91fda13 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Thu, 5 Oct 2017 14:42:41 -0700 Subject: [PATCH] vhost/rpc: replace strerror with spdk_strerror_r One instance of strerror() was introduced after the spdk_strerror_r() function was introduced in commit 4d43844f4d. Replace it with the thread-safe version. Change-Id: I83c6702f7965044ef5fa3577175f89a13dad833f Signed-off-by: Daniel Verkamp Reviewed-on: https://review.gerrithub.io/381601 Tested-by: SPDK Automated Test System Reviewed-by: Dariusz Stojaczyk Reviewed-by: Jim Harris --- lib/vhost/vhost_rpc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/vhost/vhost_rpc.c b/lib/vhost/vhost_rpc.c index f2fcb2b8f..727f27a7d 100644 --- a/lib/vhost/vhost_rpc.c +++ b/lib/vhost/vhost_rpc.c @@ -503,6 +503,7 @@ spdk_rpc_get_vhost_controllers(struct spdk_jsonrpc_request *request, { struct rpc_get_vhost_ctrlrs *ctx; struct spdk_json_write_ctx *w; + char buf[64]; if (params != NULL) { spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS, @@ -519,7 +520,8 @@ spdk_rpc_get_vhost_controllers(struct spdk_jsonrpc_request *request, ctx = calloc(1, sizeof(*ctx)); if (ctx == NULL) { - spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR, strerror(-ENOMEM)); + spdk_strerror_r(-ENOMEM, buf, sizeof(buf)); + spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR, buf); return; }