Skip to content

Commit 44dc148

Browse files
committed
replace sys/errno.h with errno.h
Historically, some systems have used <sys/errno.h> in place of <errno.h>, 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 <sys/errno.h> to <errno.h> [-Werror=cpp] 1 | #warning redirecting incorrect #include <sys/errno.h> to <errno.h> | ^~~~~~~ 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.
1 parent 967d6c5 commit 44dc148

3 files changed

Lines changed: 3 additions & 8 deletions

File tree

apps/wolfsshd/wolfsshd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
#include <errno.h>
8080
#include <unix.h>
8181
#else
82-
#include <sys/errno.h>
82+
#include <errno.h>
8383
#endif
8484

8585
static volatile int ChildRunning = 0;

examples/echoserver/echoserver.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,8 @@
8484
#if defined(__QNX__) || defined(__QNXNTO__)
8585
#include <errno.h>
8686
#include <unix.h>
87-
88-
#elif defined(USE_WINDOWS_API)
89-
#include <errno.h>
9087
#else
91-
#include <sys/errno.h>
88+
#include <errno.h>
9289
#endif
9390
#endif /* WOLFSSH_SHELL */
9491

ide/Espressif/ESP-IDF/examples/wolfssh_echoserver/main/echoserver.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,8 @@
100100
#include <errno.h>
101101
#include <unix.h>
102102

103-
#elif defined(USE_WINDOWS_API)
104-
#include <errno.h>
105103
#else
106-
#include <sys/errno.h>
104+
#include <errno.h>
107105
#endif
108106
#endif /* WOLFSSH_SHELL */
109107

0 commit comments

Comments
 (0)