From a25f40579c93bd51be395f92397105c50ef351ab Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Fri, 20 Dec 2002 00:32:18 +0000
Subject: [PATCH] Uses thread-safe version of realpath() for OpenBSD build.

---
 src/xpdev/dirwrap.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/xpdev/dirwrap.h b/src/xpdev/dirwrap.h
index 0e2a635897..9509271dda 100644
--- a/src/xpdev/dirwrap.h
+++ b/src/xpdev/dirwrap.h
@@ -61,7 +61,12 @@ extern "C" {
 	#include <glob.h>		/* POSIX.2 directory pattern matching function */
 	#define MKDIR(dir)		mkdir(dir,0777)
 
-	#define FULLPATH(a,r,l)	realpath(r,a)
+	#if defined(__OpenBSD__) && defined(_THREADWRAP_H)
+		/* realpath() not threadsafe on OpenBSD */
+	    #define FULLPATH(a,r,l) realpath_r(r,a)	/* defined in threadwrap.c */
+	#else
+		#define FULLPATH(a,r,l)	realpath(r,a)
+	#endif
 
 #else	
 
-- 
GitLab