Logs: the error of opening a log returned, not passed in errno
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Waiting to run
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-latest) (push) Waiting to run
C/C++ CI MacOS / ${{ matrix.target }} (macos-15) (push) Waiting to run
C/C++ CI Windows / ${{ matrix.target }} (windows-2022) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (macos-15) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-latest) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (windows-2022) (push) Waiting to run
C/C++ CI cmake / ubuntu-latest (wolfSSL) (push) Waiting to run

On Windows proxy.h makes errno WSAGetLastError(), which cannot be
assigned, so the Windows build failed, and the error of fopen() would
not have been read there either. A type's init returns the errno value
(the C library's, read with _get_errno() on Windows), and logget() gives
it to its caller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Vladimir DubrovinandClaude Opus 5.5 committed 2026-10-23 17:20:56 +03:00
1 parent 30e2e34dd6
commit a3c417c82a
6 files changed
+34 -23

No files matched your search

+3 -2
View File
@@ -318,12 +318,13 @@ static int srvprepare(struct srvstart *s, int argc, char **argv){
case 'l':
{
struct logger *lg;
int err = 0;
/* the same log the log command, or another service,
opened is shared with it */
if(!(lg = logget((unsigned char *)argv[i] + 2, NONE))){
if(!(lg = logget((unsigned char *)argv[i] + 2, NONE, &err))){
fprintf(stderr, "Unable to open log %.*s: %s\n",
(int)logselen((unsigned char *)argv[i] + 2), argv[i] + 2, strerror(errno));
(int)logselen((unsigned char *)argv[i] + 2), argv[i] + 2, strerror(err));
return 1;
}
logput(srv->logger);