summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJerin Jacob <jerin.jacob@caviumnetworks.com>2018-11-02 08:11:23 +0000
committerThomas Monjalon <thomas@monjalon.net>2018-11-04 22:25:20 +0100
commit11b57c69800552198218c8d9b84272f9c2d61777 (patch)
tree110ccc70a8b359023136873ec2dd57d30d4b0916 /lib
parent8d07c82b239f7782be0d3afbb626390e2cb0c8f5 (diff)
downloaddpdk-11b57c69800552198218c8d9b84272f9c2d61777.zip
dpdk-11b57c69800552198218c8d9b84272f9c2d61777.tar.gz
dpdk-11b57c69800552198218c8d9b84272f9c2d61777.tar.xz
eal: fix error string function
errno_autotest testcase were failed since commit 5d7b673d5fd6 ("mk: build with _GNU_SOURCE defined by default") RTE>>errno_autotest rte_strerror: 'Unknown error 11', strerror: 'Resource temporarily unavailable' Test Failed There are two different version of strerror_t() based on _GNU_SOURCE definition. /* XSI-compliant */ int strerror_r(int errnum, char *buf, size_t buflen); /* GNU-specific */ char *strerror_r(int errnum, char *buf, size_t buflen); Since the GNU-specific version returns char* the exiting "if" condition around the strerror_r fails. Switching back to XSI-compliant version to allow a) Portable strerror_r() usage as musl c library uses non GNU speficic version https://git.musl-libc.org/cgit/musl/tree/src/string/strerror_r.c b) Based on strerror_r(3) man page, it is possible that GNU-specific version need not use char *buf to fill error message instead it can use the immutable static string from the library and return it. note from strerror_r(3) man page: The GNU-specific strerror_r() returns a pointer to a string containing the error message. This may be either a pointer to a string that the function stores in buf, or a pointer to some (immutable) static string (in which case buf is unused). Fixes: 5d7b673d5fd6 ("mk: build with _GNU_SOURCE defined by default") Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/librte_eal/common/eal_common_errno.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/librte_eal/common/eal_common_errno.c b/lib/librte_eal/common/eal_common_errno.c
index 56b492f..c63a943 100644
--- a/lib/librte_eal/common/eal_common_errno.c
+++ b/lib/librte_eal/common/eal_common_errno.c
@@ -2,6 +2,9 @@
* Copyright(c) 2010-2014 Intel Corporation
*/
+/* Use XSI-compliant portable version of strerror_r() */
+#undef _GNU_SOURCE
+
#include <stdint.h>
#include <stdio.h>
#include <string.h>