libwine: Improve bin directory detection on FreeBSD.
This commit is contained in:
parent
6cb7cd1983
commit
c296d1fbe1
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue