From 2ce85a18a7cea45d3449578013b2e261ce773c92 Mon Sep 17 00:00:00 2001 From: Yin Fengwei Date: Thu, 26 Aug 2021 12:31:06 +0800 Subject: [PATCH] crashlog: fix build issue with e2fsprogs v1.46.2 In e2fsprogs v1.46.2, s_volume_name is defined with attribute nonstring. According to gcc doc, nostring defined string may not contain a terminating NULL. So array safed function should be used. We use strncmp instead of strcmp to do comparing here. Tracked-On: #6494 Signed-off-by: Yin Fengwei Reviewed-by: Jason Chen CJ --- misc/debug_tools/acrn_crashlog/acrnprobe/loop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/debug_tools/acrn_crashlog/acrnprobe/loop.c b/misc/debug_tools/acrn_crashlog/acrnprobe/loop.c index ad6db22ba..ee27e4aa6 100644 --- a/misc/debug_tools/acrn_crashlog/acrnprobe/loop.c +++ b/misc/debug_tools/acrn_crashlog/acrnprobe/loop.c @@ -231,7 +231,7 @@ int loopdev_check_parname(const char *loopdev, const char *parname) /* only look into the primary super block */ if (super.s_volume_name[0]) { close(fd); - return !strcmp((const char *)super.s_volume_name, parname); + return !strncmp((const char *)super.s_volume_name, parname, EXT2_LABEL_LEN); } break; }