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
@@ -384,13 +384,14 @@ static int h_external(int argc, unsigned char ** argv){
static int h_log(int argc, unsigned char ** argv){
struct logger *lg;
ROTATION rotation = (argc > 2)? getrotate(*argv[2]) : NONE;
int err = 0;
/* the same log as before is not opened again */
lg = logget((argc > 1)? argv[1] : (unsigned char *)"", rotation);
lg = logget((argc > 1)? argv[1] : (unsigned char *)"", rotation, &err);
if(!lg){
fprintf(stderr, "Unable to open log %.*s: %s, line %d\n",
(int)logselen((argc > 1)? argv[1] : (unsigned char *)""),
(argc > 1)? (char *)argv[1] : "", strerror(errno), linenum);
(argc > 1)? (char *)argv[1] : "", strerror(err), linenum);
return 1;
}
if(conf->stacksize < lg->type->stacksize) conf->stacksize = lg->type->stacksize;