osx patches
This commit is contained in:
parent
f257efc2ef
commit
06d99506cf
10
C/load_dl.c
10
C/load_dl.c
@ -74,12 +74,14 @@ Yap_FindExecutable(void)
|
|||||||
return getexecname();
|
return getexecname();
|
||||||
#elif __APPLE__
|
#elif __APPLE__
|
||||||
char path[1024];
|
char path[1024];
|
||||||
|
char *buf;
|
||||||
|
|
||||||
uint32_t size = sizeof(path);
|
uint32_t size = sizeof(path);
|
||||||
if (!_NSGetExecutablePath(path, &size)) {
|
if (!_NSGetExecutablePath(path, &size)) {
|
||||||
size_t sz = strlen(path);
|
size_t sz = strlen(path);
|
||||||
char *rc = malloc(sz+1);
|
buf = malloc(sz+1);
|
||||||
strncpy(rc, path, sz);
|
strncpy(buf, path, sz);
|
||||||
return rc;
|
return buf;
|
||||||
} else {
|
} else {
|
||||||
char *rc = malloc(size+1);
|
char *rc = malloc(size+1);
|
||||||
if (_NSGetExecutablePath(rc, &size) == 0)
|
if (_NSGetExecutablePath(rc, &size) == 0)
|
||||||
@ -95,7 +97,6 @@ Yap_FindExecutable(void)
|
|||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
free( buf );
|
|
||||||
// follow through to standard method
|
// follow through to standard method
|
||||||
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
||||||
enum { BUFFERSIZE = 1024 };
|
enum { BUFFERSIZE = 1024 };
|
||||||
@ -106,7 +107,6 @@ Yap_FindExecutable(void)
|
|||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
free( buf );
|
|
||||||
int mib[4];
|
int mib[4];
|
||||||
mib[0] = CTL_KERN;
|
mib[0] = CTL_KERN;
|
||||||
mib[1] = KERN_PROC;
|
mib[1] = KERN_PROC;
|
||||||
|
Reference in New Issue
Block a user