Merge pull request #9821 from gilles-peskine-arm/psa-storage-test-cases-never-supported-2.28-fix-copypasta

Backport 2.28: Make some edge cases of not-supported or invalid mechanisms more uniform
diff --git a/ChangeLog.d/fix-compilation-with-djgpp.txt b/ChangeLog.d/fix-compilation-with-djgpp.txt
new file mode 100644
index 0000000..5b79fb6
--- /dev/null
+++ b/ChangeLog.d/fix-compilation-with-djgpp.txt
@@ -0,0 +1,2 @@
+Bugfix
+   * Fix compilation on MS-DOS DJGPP. Fixes #9813.
diff --git a/library/net_sockets.c b/library/net_sockets.c
index 87b5a43..730d13b 100644
--- a/library/net_sockets.c
+++ b/library/net_sockets.c
@@ -529,8 +529,8 @@
 #else
     struct timeval tv;
     tv.tv_sec  = usec / 1000000;
-#if defined(__unix__) || defined(__unix) || \
-    (defined(__APPLE__) && defined(__MACH__))
+#if (defined(__unix__) || defined(__unix) || \
+    (defined(__APPLE__) && defined(__MACH__))) && !defined(__DJGPP__)
     tv.tv_usec = (suseconds_t) usec % 1000000;
 #else
     tv.tv_usec = usec % 1000000;