summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Cavalcante de Sousa <lucks.sousa@gmail.com>2020-06-26 12:51:01 +0000
committerStefan Schmidt <s.schmidt@samsung.com>2020-06-26 17:17:13 +0200
commita733f9c233aed3e02670ccb317d201bee31305b7 (patch)
tree981572abaa446f89e2c63ecddee64d3dec70f4e8
parentcdaac43d3a9f339ccf0f27c2fdab7f7b191d0ebd (diff)
downloadefl-a733f9c233aed3e02670ccb317d201bee31305b7.tar.gz
Native Windows: Eina: Resolve bad comparison while using windows strerror_s
`strerror_s` is the windows alternative of `strerror_r` used by EFL. `strerror_s` never return the error code with the message as `strerror_r` does, because of that, while comparing the first 14 characters of `Unknown error ` to the message from unknown code 4096 (`Unknown error`) they were accusing being different - in UNIX this works because the message returned is `Unknown error 4096`. This error was noticeable at `eina_error_test_failures` test case. This Diff adds the error code to the message in case of an `Unknown error`, making the windows implementation compliant with UNIX. Reviewed-by: Vincent Torri <vincent.torri@gmail.com> Reviewed-by: Wander Lairson Costa <wander.lairson@gmail.com> Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org> Differential Revision: https://phab.enlightenment.org/D12033
-rw-r--r--src/lib/eina/eina_error.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/eina/eina_error.c b/src/lib/eina/eina_error.c
index 7922933e59..b9f05a5a9d 100644
--- a/src/lib/eina/eina_error.c
+++ b/src/lib/eina/eina_error.c
@@ -115,7 +115,13 @@ _eina_error_msg_alloc(void)
/* Windows has strerror_s(), similar to POSIX strerror_r() */
static inline int strerror_r(int errnum, char *buf, size_t buflen)
{
- return strerror_s(buf, buflen, errnum);
+ int ret;
+
+ ret = strerror_s(buf, buflen, errnum);
+ if (strcmp(buf, "Unknown error") == 0)
+ snprintf(buf, buflen, "Unknown error %d", errnum);
+
+ return ret;
}
#endif