Skip to content
Snippets Groups Projects
Commit 49ef7223 authored by deuce's avatar deuce
Browse files

Use realpath_r for FreeBSD builds... appears to fail on rare occasions in

release builds.
parent d24195c5
No related branches found
No related tags found
No related merge requests found
......@@ -61,8 +61,9 @@ extern "C" {
#include <glob.h> /* POSIX.2 directory pattern matching function */
#define MKDIR(dir) mkdir(dir,0777)
#if defined(__OpenBSD__) && defined(_THREADWRAP_H)
/* realpath() not threadsafe on OpenBSD */
#if defined(BSD) && defined(_THREADWRAP_H)
/* realpath() not threadsafe on OpenBSD -or- FreeBSD */
/* (On FreeBSD it only fails in release builds! */
#define FULLPATH(a,r,l) realpath_r(r,a) /* defined in threadwrap.c */
#else
#define FULLPATH(a,r,l) realpath(r,a)
......
......@@ -84,8 +84,9 @@ ulong _beginthread(void( *start_address )( void * )
/****************************************************************************/
/* Thread-safe (reentrant) version of realpath() - required for OpenBSD */
/* And for NON-DEBUG FreeBSD builds (on 4.7 anyways) */
/****************************************************************************/
#if defined(__OpenBSD__)
#if defined(BSD)
char* realpath_r(const char *pathname, char *resolvedname)
{
static pthread_mutex_t mutex=PTHREAD_MUTEX_INITIALIZER;
......
......@@ -56,7 +56,7 @@ extern "C" {
ulong _beginthread(void( *start_address )( void * )
,unsigned stack_size, void *arglist);
#if defined(__OpenBSD__) /* thread-safe version of realpath for OpenBSD */
#if defined(BSD) /* thread-safe version of realpath for BSD */
char* realpath_r(const char *pathname, char *resolvedname);
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment