mirror of
https://github.com/php/php-src.git
synced 2026-03-25 16:52:18 +01:00
fuzzer support for FreeBSD, getting opcache location
Closes GH-7926.
This commit is contained in:
@@ -16,6 +16,10 @@
|
||||
|
||||
#include <main/php.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
# include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
#include "fuzzer.h"
|
||||
#include "fuzzer-sapi.h"
|
||||
#include "zend_exceptions.h"
|
||||
@@ -140,7 +144,13 @@ ZEND_ATTRIBUTE_UNUSED char *get_opcache_path(void) {
|
||||
|
||||
/* Try relative to binary location. */
|
||||
char path[MAXPATHLEN];
|
||||
#if defined(__FreeBSD__)
|
||||
size_t pathlen = sizeof(path);
|
||||
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
|
||||
if (sysctl(mib, 4, path, &pathlen, NULL, 0) < 0) {
|
||||
#else
|
||||
if (readlink("/proc/self/exe", path, sizeof(path)) < 0) {
|
||||
#endif
|
||||
ZEND_ASSERT(0 && "Failed to get binary path");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user