Skip to content

Commit 9b743d4

Browse files
committed
fix: re fix windows build
1 parent c120f33 commit 9b743d4

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

ext/opcache/zend_static_cache_storage.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -651,15 +651,25 @@ static void zend_opcache_static_cache_unlock_impl(void)
651651
#else
652652
static bool zend_opcache_static_cache_win32_open_lock_file_at(zend_opcache_static_cache_storage *storage, const char *directory, const char *base_name)
653653
{
654+
size_t directory_len;
655+
const char *separator;
656+
654657
if (directory == NULL || directory[0] == '\0') {
655658
return false;
656659
}
657660

661+
directory_len = strlen(directory);
662+
separator = directory[directory_len - 1] == '/' || directory[directory_len - 1] == '\\'
663+
? ""
664+
: "/"
665+
;
666+
658667
snprintf(
659668
storage->lockfile_name,
660669
sizeof(storage->lockfile_name),
661-
"%s/%s.lock",
670+
"%s%s%s.lock",
662671
directory,
672+
separator,
663673
base_name
664674
);
665675

@@ -681,10 +691,6 @@ static bool zend_opcache_static_cache_win32_open_lock_file(zend_opcache_static_c
681691
storage->size
682692
);
683693

684-
if (zend_opcache_static_cache_win32_open_lock_file_at(storage, ZCG(accel_directives).lockfile_path, base_name)) {
685-
return true;
686-
}
687-
688694
temp_path_len = GetTempPathA(sizeof(temp_path), temp_path);
689695
if (temp_path_len == 0 || temp_path_len >= sizeof(temp_path)) {
690696
return false;

0 commit comments

Comments
 (0)