mirror of
https://github.com/darlinghq/cctools-port.git
synced 2024-11-23 12:19:40 +00:00
use KERN_PROC_ARGV instead of KERN_PROC_ENV
This commit is contained in:
parent
7a9b23fbb2
commit
359b40b5bd
@ -56,10 +56,10 @@ int _NSGetExecutablePath(char *path, unsigned int *size)
|
||||
mib[0] = CTL_KERN;
|
||||
mib[1] = KERN_PROC_ARGS;
|
||||
mib[2] = getpid();
|
||||
mib[3] = KERN_PROC_ENV;
|
||||
mib[3] = KERN_PROC_ARGV;
|
||||
if (sysctl(mib, 4, tmp, &l, NULL, 0) != 0)
|
||||
return -1;
|
||||
*size = strlcpy(path, strchr(tmp[0], '=') + 1, *size);
|
||||
*size = strlcpy(path, tmp[0], *size);
|
||||
return 0;
|
||||
#else
|
||||
int bufsize = *size;
|
||||
|
@ -38,10 +38,10 @@ int _NSGetExecutablePath(char *path, unsigned int *size)
|
||||
mib[0] = CTL_KERN;
|
||||
mib[1] = KERN_PROC_ARGS;
|
||||
mib[2] = getpid();
|
||||
mib[3] = KERN_PROC_ENV;
|
||||
mib[3] = KERN_PROC_ARGV;
|
||||
if (sysctl(mib, 4, tmp, &l, NULL, 0) != 0)
|
||||
return -1;
|
||||
*size = strlcpy(path, strchr(tmp[0], '=') + 1, *size);
|
||||
*size = strlcpy(path, tmp[0], *size);
|
||||
return 0;
|
||||
#else
|
||||
int bufsize = *size;
|
||||
|
Loading…
Reference in New Issue
Block a user