... to make its behavior the same as C standard (e.g., C99 and C11). Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- Cc: Jan Beulich <jbeul...@suse.com> Cc: Andrew Cooper <andrew.coop...@citrix.com> Cc: Ian Jackson <ian.jack...@eu.citrix.com> Cc: Wei Liu <wei.l...@citrix.com> --- tools/firmware/hvmloader/util.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/tools/firmware/hvmloader/util.c b/tools/firmware/hvmloader/util.c index 0c3f2d24cd..76a61ee052 100644 --- a/tools/firmware/hvmloader/util.c +++ b/tools/firmware/hvmloader/util.c @@ -141,9 +141,16 @@ int strcmp(const char *cs, const char *ct) int strncmp(const char *s1, const char *s2, uint32_t n) { uint32_t ctr; + for (ctr = 0; ctr < n; ctr++) + { if (s1[ctr] != s2[ctr]) return (int)(s1[ctr] - s2[ctr]); + + if (!s1[ctr]) + break; + } + return 0; } -- 2.15.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel