mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Try to fetch opcache.so path relative to binary
While the cwd-relative lookup worked for the oss-fuzz docker images, it doesn't seem to work on the cluster infrastructure. Try finding opcache.so relative to the binary instead.
This commit is contained in:
parent
ac34648cf6
commit
b732b6d06f
1 changed files with 14 additions and 3 deletions
|
@ -126,7 +126,18 @@ ZEND_ATTRIBUTE_UNUSED static void opcache_invalidate(void) {
|
|||
}
|
||||
|
||||
ZEND_ATTRIBUTE_UNUSED char *get_opcache_path(void) {
|
||||
// TODO: Make this more general.
|
||||
char *opcache_path = "modules/opcache.so";
|
||||
return realpath(opcache_path, NULL);
|
||||
/* Try relative to cwd. */
|
||||
char *p = realpath("modules/opcache.so", NULL);
|
||||
if (p) {
|
||||
return p;
|
||||
}
|
||||
|
||||
/* Try relative to binary location. */
|
||||
char path[MAXPATHLEN];
|
||||
if (readlink("/proc/self/exe", path, sizeof(path)) < 0) {
|
||||
ZEND_ASSERT(0 && "Failed to get binary path");
|
||||
return NULL;
|
||||
}
|
||||
strlcat(path, "/modules/opcache.so", sizeof(path));
|
||||
return realpath(path, NULL);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue