mirror of
https://github.com/haproxy/haproxy.git
synced 2026-04-15 21:59:41 -04:00
BUILD: tools: get the absolute path of the current binary on NetBSD.
NetBSD stores the absolute path into the auxiliary vector as well.
This commit is contained in:
parent
af2720f69f
commit
bd2ccedcc5
1 changed files with 13 additions and 0 deletions
13
src/tools.c
13
src/tools.c
|
|
@ -16,6 +16,11 @@
|
|||
#include <link.h>
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
#include <sys/exec_elf.h>
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <netdb.h>
|
||||
|
|
@ -4761,6 +4766,14 @@ const char *get_exec_path()
|
|||
|
||||
if (execfn && execfn != ENOENT)
|
||||
ret = (const char *)execfn;
|
||||
#elif defined(__NetBSD__)
|
||||
AuxInfo *auxv;
|
||||
for (auxv = _dlauxinfo(); auxv->a_type != AT_NULL; ++auxv) {
|
||||
if (auxv->a_type == AT_SUN_EXECNAME) {
|
||||
ret = (const char *)auxv->a_v;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue