Merge branch 'bs/runtime-prefix-obsd-getexecpath' into seen
* bs/runtime-prefix-obsd-getexecpath: exec_cmd: RUNTIME_PREFIX on OpenBSD systems
commit
6cca85d52d
7
Makefile
7
Makefile
|
|
@ -379,6 +379,9 @@ include shared.mak
|
|||
# Perl scripts to use a modified entry point header allowing them to resolve
|
||||
# support files at runtime.
|
||||
#
|
||||
# When using RUNTIME_PREFIX, define HAVE_GETEXECPATH if your platform supports
|
||||
# the getexecpath() function.
|
||||
#
|
||||
# When using RUNTIME_PREFIX, define HAVE_BSD_KERN_PROC_SYSCTL if your platform
|
||||
# supports the KERN_PROC BSD sysctl function.
|
||||
#
|
||||
|
|
@ -2368,6 +2371,10 @@ endif
|
|||
|
||||
ifdef RUNTIME_PREFIX
|
||||
|
||||
ifdef HAVE_GETEXECPATH
|
||||
BASIC_CFLAGS += -DHAVE_GETEXECPATH
|
||||
endif
|
||||
|
||||
ifdef HAVE_BSD_KERN_PROC_SYSCTL
|
||||
BASIC_CFLAGS += -DHAVE_BSD_KERN_PROC_SYSCTL
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -343,6 +343,9 @@ ifeq ($(uname_S),OpenBSD)
|
|||
CSPRNG_METHOD = arc4random
|
||||
FREAD_READS_DIRECTORIES = UnfortunatelyYes
|
||||
FILENO_IS_A_MACRO = UnfortunatelyYes
|
||||
ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 8 && echo 1),1)
|
||||
HAVE_GETEXECPATH = YesPlease
|
||||
endif
|
||||
endif
|
||||
ifeq ($(uname_S),MirBSD)
|
||||
NO_STRCASESTR = YesPlease
|
||||
|
|
|
|||
24
exec-cmd.c
24
exec-cmd.c
|
|
@ -129,6 +129,26 @@ static int git_get_exec_path_bsd_sysctl(struct strbuf *buf)
|
|||
}
|
||||
#endif /* HAVE_BSD_KERN_PROC_SYSCTL */
|
||||
|
||||
#ifdef HAVE_GETEXECPATH
|
||||
/*
|
||||
* Resolves the executable path using getexecpath(3).
|
||||
*
|
||||
* Returns 0 on success, -1 on failure.
|
||||
*/
|
||||
static int git_get_exec_path_getexecpath(struct strbuf *buf)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
if (getexecpath(path, sizeof(path)) == 0) {
|
||||
trace_printf(
|
||||
"trace: resolved executable path from getexecpath: %s\n",
|
||||
path);
|
||||
strbuf_addstr(buf, path);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
#endif /* HAVE_GETEXECPATH */
|
||||
|
||||
#ifdef HAVE_NS_GET_EXECUTABLE_PATH
|
||||
/*
|
||||
* Resolves the executable path by querying Darwin application stack.
|
||||
|
|
@ -209,6 +229,10 @@ static int git_get_exec_path(struct strbuf *buf, const char *argv0)
|
|||
* after the first successful method.
|
||||
*/
|
||||
if (
|
||||
#ifdef HAVE_GETEXECPATH
|
||||
git_get_exec_path_getexecpath(buf) &&
|
||||
#endif /* HAVE_GETEXECPATH */
|
||||
|
||||
#ifdef HAVE_BSD_KERN_PROC_SYSCTL
|
||||
git_get_exec_path_bsd_sysctl(buf) &&
|
||||
#endif /* HAVE_BSD_KERN_PROC_SYSCTL */
|
||||
|
|
|
|||
Loading…
Reference in New Issue