From 1e22a1b90b2d778e1334e76a93af8efeb63fedfb Mon Sep 17 00:00:00 2001 From: Lucas Cavalcante de Sousa Date: Wed, 20 May 2020 09:47:07 -0300 Subject: [PATCH] eina: Resolve string comparison from strerror_s when no code is returned On Windows, `strerror_s` doesn't return the error code with the error message string as `strerror_r` on Linux does. So we do not compare the last space before the error code, comparing 13 characters instead of 14. Thus comparing for "Unknown error" correctly for all platforms. --- src/lib/eina/eina_error.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/eina/eina_error.c b/src/lib/eina/eina_error.c index 43851728e5..8362aa4531 100644 --- a/src/lib/eina/eina_error.c +++ b/src/lib/eina/eina_error.c @@ -355,7 +355,7 @@ eina_error_msg_get(Eina_Error error) EINA_SAFETY_ERROR("strerror_r() failed"); else { - if (strncmp(str, unknown_prefix, sizeof(unknown_prefix) -1) == 0) + if (strncmp(str, unknown_prefix, sizeof(unknown_prefix) - 2) == 0) msg = NULL; else {