Commit e3a59737 authored by David CARLIER's avatar David CARLIER Committed by Robert Bindar

mariabackup utility, binary path implementation for Mac.

implements in a native way get_exepath which gives reliably the full
path.
parent 1d762ee8
...@@ -61,6 +61,10 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA ...@@ -61,6 +61,10 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA
#include <sys/resource.h> #include <sys/resource.h>
#endif #endif
#ifdef __APPLE__
# include "libproc.h"
#endif
#include <btr0sea.h> #include <btr0sea.h>
#include <dict0priv.h> #include <dict0priv.h>
...@@ -6913,6 +6917,12 @@ static int get_exepath(char *buf, size_t size, const char *argv0) ...@@ -6913,6 +6917,12 @@ static int get_exepath(char *buf, size_t size, const char *argv0)
ssize_t ret = readlink("/proc/self/exe", buf, size-1); ssize_t ret = readlink("/proc/self/exe", buf, size-1);
if(ret > 0) if(ret > 0)
return 0; return 0;
#elif defined(__APPLE__)
size_t ret = proc_pidpath(getpid(), buf, static_cast<uint32_t>(size));
if (ret > 0) {
buf[ret] = 0;
return 0;
}
#endif #endif
return my_realpath(buf, argv0, 0); return my_realpath(buf, argv0, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment