git » libfiu » commit aaf1188

preload/posix: Do not wrap strdup() if it's a macro

author Alberto Bertogli
2012-08-26 21:05:29 UTC
committer Alberto Bertogli
2012-08-26 21:46:22 UTC
parent 6825143135e5a6b9be7041d3319d32c03c2ed701

preload/posix: Do not wrap strdup() if it's a macro

glibc, when _GNU_SOURCE is defined, can have macros for strdup/strndup, so we
need to avoid generating wrappers for them.

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

preload/posix/modules/libc.str.mod +8 -1

diff --git a/preload/posix/modules/libc.str.mod b/preload/posix/modules/libc.str.mod
index 3873d19..b9c7690 100644
--- a/preload/posix/modules/libc.str.mod
+++ b/preload/posix/modules/libc.str.mod
@@ -1,15 +1,22 @@
 
 include: <string.h>
 include: <errno.h>
+include: <stdlib.h>
 
 fiu name base: libc/str/
 
+# glibc, when _GNU_SOURCE is defined, can have macros for strdup/strndup, so
+# we need to avoid those.
+
+v: #ifndef strdup
 char *strdup(const char *s);
 	on error: NULL
 	valid errnos: ENOMEM
+v: #endif
 
+v: #ifndef strndup
 char *strndup(const char *s, size_t n);
 	on error: NULL
 	valid errnos: ENOMEM
-
+v: #endif