summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid CARLIER <devnexen@gmail.com>2021-02-03 19:44:34 +0000
committerRobert Bindar <robert@mariadb.org>2021-03-09 15:51:38 +0200
commite3a597378ebfc69e044e5c0317a337bd46a593bf (patch)
treec926b58320e98e721982272324a0d590be5d1473
parent1d762ee8fe6b2e2b031cfaa95429408479f7eb67 (diff)
downloadmariadb-git-e3a597378ebfc69e044e5c0317a337bd46a593bf.tar.gz
mariabackup utility, binary path implementation for Mac.
implements in a native way get_exepath which gives reliably the full path.
-rw-r--r--extra/mariabackup/xtrabackup.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index 49a774ba576..f02520787e6 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -61,6 +61,10 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA
#include <sys/resource.h>
#endif
+#ifdef __APPLE__
+# include "libproc.h"
+#endif
+
#include <btr0sea.h>
#include <dict0priv.h>
@@ -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);
if(ret > 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
return my_realpath(buf, argv0, 0);