Damjan Jovanovic : libwine: Improve bin directory detection on FreeBSD.

Alexandre Julliard julliard at winehq.org
Mon Jun 4 13:27:13 CDT 2012


Module: wine
Branch: master
Commit: c296d1fbe1b551c7cf7c159a03c9198592dbae73
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c296d1fbe1b551c7cf7c159a03c9198592dbae73

Author: Damjan Jovanovic <damjan.jov at gmail.com>
Date:   Sun Jun  3 12:26:30 2012 +0200

libwine: Improve bin directory detection on FreeBSD.

---

 libs/wine/config.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/libs/wine/config.c b/libs/wine/config.c
index 035c268..031850b 100644
--- a/libs/wine/config.c
+++ b/libs/wine/config.c
@@ -53,6 +53,12 @@ static void fatal_error( const char *err, ... )  __attribute__((noreturn,format(
 static void fatal_perror( const char *err, ... )  __attribute__((noreturn,format(printf,1,2)));
 #endif
 
+#ifdef __linux__
+#define EXE_LINK "/proc/self/exe"
+#elif defined (__FreeBSD__)
+#define EXE_LINK "/proc/curproc/file"
+#endif
+
 /* die on a fatal error */
 static void fatal_error( const char *err, ... )
 {
@@ -151,12 +157,12 @@ static char *get_runtime_bindir( const char *argv0 )
     char *p, *bindir, *cwd;
     int len, size;
 
-#ifdef linux
+#ifdef EXE_LINK
     for (size = 256; ; size *= 2)
     {
         int ret;
         if (!(bindir = malloc( size ))) break;
-        if ((ret = readlink( "/proc/self/exe", bindir, size )) == -1) break;
+        if ((ret = readlink( EXE_LINK, bindir, size )) == -1) break;
         if (ret != size)
         {
             if (!(p = memrchr( bindir, '/', ret ))) break;




More information about the wine-cvs mailing list