MDEV-34340 mariadb-backup immediately dumps core on NetBSD

Provided implementation for my_get_exepath for NetBSD to
avoid segfaults in execution of mariadb-backup.
This commit is contained in:
Thomas Klausner 2024-09-24 09:35:08 +10:00 committed by Daniel Black
parent f9f1d26f2a
commit 3a4bc9aa35

View file

@ -23,6 +23,9 @@
#include <libproc.h>
#elif defined(__FreeBSD__)
#include <sys/sysctl.h>
#elif defined(__NetBSD__)
#include <sys/param.h>
#include <sys/sysctl.h>
#endif
/** Fill the buffer with the executable program name
@ -51,6 +54,10 @@ int my_get_exepath(char *buf, size_t size, const char *argv0)
if (sysctl(mib, 4, buf, &size, NULL, 0) == 0) {
return 0;
}
#elif defined(__NetBSD__)
int mib[4] = {CTL_KERN, KERN_PROC_ARGS, -1, KERN_PROC_PATHNAME };
if (sysctl(mib, 4, buf, &size, NULL, 0) == 0)
return 0;
#endif
if (argv0)