Skip to content

Commit 31b02a1

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Fix GH-8923: error_log on Windows can hold the file write lock
2 parents 227a857 + 5a459f6 commit 31b02a1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

main/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,9 +832,10 @@ PHPAPI ZEND_COLD void php_log_err_with_severity(const char *log_message, int sys
832832
#endif
833833
len = spprintf(&tmp, 0, "[%s] %s%s", ZSTR_VAL(error_time_str), log_message, PHP_EOL);
834834
#ifdef PHP_WIN32
835-
php_flock(fd, 2);
835+
php_flock(fd, LOCK_EX);
836836
/* XXX should eventually write in a loop if len > UINT_MAX */
837837
php_ignore_value(write(fd, tmp, (unsigned)len));
838+
php_flock(fd, LOCK_UN);
838839
#else
839840
php_ignore_value(write(fd, tmp, len));
840841
#endif

0 commit comments

Comments
 (0)