Skip to content

Commit

Permalink
mariabackup utility, binary path implementation for Mac.
Browse files Browse the repository at this point in the history
implements in a native way get_exepath which gives reliably the full
path.
  • Loading branch information
devnexen authored and robertbindar committed Mar 9, 2021
1 parent 1d762ee commit e3a5973
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions extra/mariabackup/xtrabackup.cc
Expand Up @@ -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>
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit e3a5973

Please sign in to comment.