Commit c296d1fb authored by Damjan Jovanovic's avatar Damjan Jovanovic Committed by Alexandre Julliard

libwine: Improve bin directory detection on FreeBSD.

parent 6cb7cd19
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment