From 44dc148dbd68ad4610b87cfc217967f9b4ceddbf Mon Sep 17 00:00:00 2001 From: hanshenrik Date: Sat, 22 Nov 2025 17:30:13 +0100 Subject: [PATCH] replace sys/errno.h with errno.h Historically, some systems have used in place of , but the C standard, all the way back to C89/Ansi C, specifies that the correct name is `errno.h` - and most modern compilers create a sys/errno.h compatibility shim sys/errno.h - but musl-gcc does not have this compatibility shim, reasoning that sys/errno.h is non-standard, and fails to compile: ``` $ CC=musl-gcc ./configure --enable-static --disable-shared --enable-scp --enable-sftp --enable-shell --with-wolfssl=wolfssl/install-musl (...) $ make make -j17 all-am make[1]: Entering directory '/home/hans/projects/wolfssh' CC examples/client/common.o CC examples/client/client.o CC src/libwolfssh_la-ssh.lo CC src/libwolfssh_la-internal.lo CC src/libwolfssh_la-log.lo CC src/libwolfssh_la-port.lo CC src/libwolfssh_la-io.lo CC src/libwolfssh_la-wolfscp.lo CC src/libwolfssh_la-wolfsftp.lo CC examples/echoserver/echoserver.o CC src/libwolfssh_la-wolfterm.lo CC examples/sftpclient/sftpclient.o CC examples/scpclient/scpclient.o In file included from examples/echoserver/echoserver.c:91: /usr/include/x86_64-linux-musl/sys/errno.h:1:2: error: #warning redirecting incorrect #include to [-Werror=cpp] 1 | #warning redirecting incorrect #include to | ^~~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:1452: examples/echoserver/echoserver.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make[1]: Leaving directory '/home/hans/projects/wolfssh' make: *** [Makefile:1020: all] Error 2 ``` so, unless we need to support pre-C89 (35+ year old C) compilers, we can just replace sys/errno.h with errno.h. --- apps/wolfsshd/wolfsshd.c | 2 +- examples/echoserver/echoserver.c | 5 +---- .../ESP-IDF/examples/wolfssh_echoserver/main/echoserver.c | 4 +--- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/apps/wolfsshd/wolfsshd.c b/apps/wolfsshd/wolfsshd.c index d2bb08ab6..442279efe 100644 --- a/apps/wolfsshd/wolfsshd.c +++ b/apps/wolfsshd/wolfsshd.c @@ -79,7 +79,7 @@ #include #include #else - #include + #include #endif static volatile int ChildRunning = 0; diff --git a/examples/echoserver/echoserver.c b/examples/echoserver/echoserver.c index fb7011d82..1c44b7f94 100644 --- a/examples/echoserver/echoserver.c +++ b/examples/echoserver/echoserver.c @@ -84,11 +84,8 @@ #if defined(__QNX__) || defined(__QNXNTO__) #include #include - -#elif defined(USE_WINDOWS_API) - #include #else - #include + #include #endif #endif /* WOLFSSH_SHELL */ diff --git a/ide/Espressif/ESP-IDF/examples/wolfssh_echoserver/main/echoserver.c b/ide/Espressif/ESP-IDF/examples/wolfssh_echoserver/main/echoserver.c index 494809424..99d3f45f4 100644 --- a/ide/Espressif/ESP-IDF/examples/wolfssh_echoserver/main/echoserver.c +++ b/ide/Espressif/ESP-IDF/examples/wolfssh_echoserver/main/echoserver.c @@ -100,10 +100,8 @@ #include #include -#elif defined(USE_WINDOWS_API) - #include #else - #include + #include #endif #endif /* WOLFSSH_SHELL */