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 <fengwei.yin@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
This commit is contained in:
Yin Fengwei 2021-08-26 12:31:06 +08:00 committed by wenlingz
parent b70d132f0d
commit 2ce85a18a7
1 changed files with 1 additions and 1 deletions

View File

@ -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;
}