Get rid of /proc dependency.
PR: ports/181659 Submitted by: Jan Beich <jbeich at tormail dot org>
This commit is contained in:
parent
019f2422aa
commit
79aea805a8
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=326130
2 changed files with 31 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
PORTNAME= android-tools-adb
|
||||
PORTVERSION= 4.3
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= devel
|
||||
DISTNAME= android-platform_system_core-${GH_COMMIT}
|
||||
|
||||
|
|
30
devel/android-tools-adb/files/patch-get_my_path_freebsd.c
Normal file
30
devel/android-tools-adb/files/patch-get_my_path_freebsd.c
Normal file
|
@ -0,0 +1,30 @@
|
|||
--- get_my_path_freebsd.c.orig 2013-09-03 17:33:27.000000000 +0800
|
||||
+++ get_my_path_freebsd.c 2013-09-03 17:41:13.000000000 +0800
|
||||
@@ -18,19 +18,18 @@
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
+#include <sys/sysctl.h>
|
||||
#include <unistd.h>
|
||||
-#include <limits.h>
|
||||
-#include <stdio.h>
|
||||
|
||||
void
|
||||
get_my_path(char *exe, size_t maxLen)
|
||||
{
|
||||
- char proc[64];
|
||||
+ int mib[4] = {
|
||||
+ CTL_KERN,
|
||||
+ KERN_PROC,
|
||||
+ KERN_PROC_PATHNAME,
|
||||
+ getpid()
|
||||
+ };
|
||||
|
||||
- snprintf(proc, sizeof(proc), "/proc/%d/file", getpid());
|
||||
-
|
||||
- int err = readlink(proc, exe, maxLen - 1);
|
||||
-
|
||||
- exe[err > 0 ? err : 0] = '\0';
|
||||
+ sysctl(mib, 4, exe, &maxLen, NULL, 0);
|
||||
}
|
||||
-
|
Loading…
Reference in a new issue