path: root/libglusterfs/src/compat.c
diff options
authorEmmanuel Dreyfus <>2012-05-16 06:36:19 +0200
committerAnand Avati <>2012-05-18 19:17:58 -0700
commitc023c1517a0b8adb3c24ddc6dfa30e4242076ee8 (patch)
tree955520600f45f030777b058ec81c1443340a6609 /libglusterfs/src/compat.c
parentb71d314482d572f7e54a306bb566f0f8883b2ce8 (diff)
Provide missing basename_r and dirname_r
Some systems (e.g.: NetBSD) do not have thread-safe basename(3) and dirname(3). This is fine with OpenGroup's Single Unix Specification which allows these functions to use static storage. Unfortunately, glusterfs uses them a lot and assume thread-safety. This patch brings FreeBSD's thread-safe basename_r(3) and dirname_r(3) in the contrib directory, and tweaks the build process so that NetBSD builds use them instead of libc basename(3) and dirname(3) BUG: 764655 Change-Id: Ic9a159fffdc7bacc9408f8e90854e4c2db81930c Signed-off-by: Emmanuel Dreyfus <> Reviewed-on: Tested-by: Gluster Build System <> Reviewed-by: Kaleb KEITHLEY <> Reviewed-by: Anand Avati <>
Diffstat (limited to 'libglusterfs/src/compat.c')
1 files changed, 7 insertions, 0 deletions
diff --git a/libglusterfs/src/compat.c b/libglusterfs/src/compat.c
index 2dcd56a41..99a0041a5 100644
--- a/libglusterfs/src/compat.c
+++ b/libglusterfs/src/compat.c
@@ -550,3 +550,10 @@ strnlen(const char *string, size_t maxlen)
return len;
#endif /* STRNLEN */
+#include "../../contrib/libgen/basename_r.c"
+#include "../../contrib/libgen/dirname_r.c"