From 6ee9d105695e4fd8ea86d8c173b234e2df12eb51 Mon Sep 17 00:00:00 2001 From: Emmanuel Dreyfus Date: Fri, 15 Jun 2012 09:49:15 +0200 Subject: Switch to GNU basename_r() and dirname_r() This is a backport of Change-Id Ic9a159fffdc7bacc9408f8e90854e4c2db81930c and Id874b9c7aacd9aa3a7a4bd6a92a9633f5b2d6ac0 BUG: 764655 Change-Id: I51aac601fb4cc9a0d87afcab2240dc7a1d131c93 Signed-off-by: Emmanuel Dreyfus Reviewed-on: http://review.gluster.com/3576 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- libglusterfs/src/compat.c | 7 +++++++ libglusterfs/src/compat.h | 16 +++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'libglusterfs/src') diff --git a/libglusterfs/src/compat.c b/libglusterfs/src/compat.c index 2dcd56a4144..99a0041a5cf 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 */ + +#ifdef THREAD_UNSAFE_BASENAME +#include "../../contrib/libgen/basename_r.c" +#endif +#ifdef THREAD_UNSAFE_DIRNAME +#include "../../contrib/libgen/dirname_r.c" +#endif diff --git a/libglusterfs/src/compat.h b/libglusterfs/src/compat.h index 24ceed22e80..af890485df5 100644 --- a/libglusterfs/src/compat.h +++ b/libglusterfs/src/compat.h @@ -107,13 +107,6 @@ enum { #define F_SETLK64 F_SETLK #define F_SETLKW64 F_SETLKW -#ifdef __NetBSD__ -char *basename_r(const char *); -char *dirname_r(char *); - -#define basename(path) basename_r(path) -#define dirname(path) dirname_r(path) -#endif /* __NetBSD__ */ #endif /* GF_BSD_HOST_OS */ #ifdef GF_DARWIN_HOST_OS @@ -341,6 +334,15 @@ dirent_size (struct dirent *entry) return size; } +#ifdef THREAD_UNSAFE_BASENAME +char *basename_r(const char *); +#define basename(path) basename_r(path) +#endif /* THREAD_UNSAFE_BASENAME */ + +#ifdef THREAD_UNSAFE_DIRNAME +char *dirname_r(char *path); +#define dirname(path) dirname_r(path) +#endif /* THREAD_UNSAFE_DIRNAME */ #ifdef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC /* Linux, Solaris, Cygwin */ -- cgit