From 1fcb175fee67f8d3e92f93b9958e983c01ac4b4a Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Thu, 21 Jan 2021 12:45:17 -0600 Subject: [PATCH] Fix probing cache device in casadm Signed-off-by: Adam Rutkowski --- casadm/cas_lib.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/casadm/cas_lib.c b/casadm/cas_lib.c index 345058398..d1bb0250f 100644 --- a/casadm/cas_lib.c +++ b/casadm/cas_lib.c @@ -2849,6 +2849,11 @@ int _check_cache_device(const char *device_path, { int result, fd; + if (strncpy_s(cmd_info->path_name, sizeof(cmd_info->path_name), + device_path, MAX_STR_LEN)) { + return FAILURE; + } + fd = open_ctrl_device(); if (fd == -1) return FAILURE; @@ -2857,7 +2862,7 @@ int _check_cache_device(const char *device_path, close(fd); - return result; + return result ? FAILURE : SUCCESS; } int check_cache_device(const char *device_path)