[php-src] PR #13921: Fix usage of reentrant functions in ext/posix
| From: | arnaud-lb | Date: | Tue, 09 Apr 2024 12:04:36 +0000 |
| Subject: | [php-src] PR #13921: Fix usage of reentrant functions in ext/posix | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-25682@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/13921
Author: arnaud-lb
- It's not necessarily an error of sysconf(_SC_GETPW_R_SIZE_MAX) returns -1, as specified by
posix (and the musl implementation always returns -1). Pick an initial buffer size in this case.
- Reentrant variants return an error number an may not set errno
- Implement retry logic for ttyname_r()
- Fix retry logic for getpwnam_r() (pw would be NULL after the first try)
- Test retry logic by setting the initial buffer size to 1 in debug builds
Tests for these functions would fail under musl due to
sysconf(_SC_GETPW_R_SIZE_MAX)
returning -1 (which is allowed by the standard). The test suite passed on other platforms, but these
functions could fail under unusual conditions. Setting buflen to 1 ensures that the retry logic is
tested.