lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 21 Jan 2023 12:32:28 -0800
From:   Eric Biggers <ebiggers@...nel.org>
To:     linux-ext4@...r.kernel.org
Subject: [PATCH 36/38] misc/util.c: enable MinGW alarm() when building for Windows

From: Eric Biggers <ebiggers@...gle.com>

To compile for Windows, this file needs MinGW's implementation of
alarm().  To expose that definition, some macros must be defined before
including the system headers.  This was done in Android.bp, but it was
not done in the autotools-based build system.  Define these macros in
the source file itself so that all build systems work.

Signed-off-by: Eric Biggers <ebiggers@...gle.com>
---
 misc/Android.bp | 2 --
 misc/util.c     | 5 +++++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/misc/Android.bp b/misc/Android.bp
index 2baeac2ad..2b1620ac6 100644
--- a/misc/Android.bp
+++ b/misc/Android.bp
@@ -83,8 +83,6 @@ cc_binary {
         windows: {
             include_dirs: [ "external/e2fsprogs/include/mingw" ],
             cflags: [
-                "-D_POSIX",
-                "-D__USE_MINGW_ALARM",
                 // mke2fs.c has a warning from gcc which cannot be suppressed:
                 // passing argument 3 of 'ext2fs_get_device_size' from
                 // incompatible pointer type
diff --git a/misc/util.c b/misc/util.c
index e84ebab5b..3e83169f1 100644
--- a/misc/util.c
+++ b/misc/util.c
@@ -16,6 +16,11 @@
 #define _LARGEFILE64_SOURCE
 #endif
 
+#ifdef _WIN32
+#define _POSIX
+#define __USE_MINGW_ALARM
+#endif
+
 #include "config.h"
 #include <fcntl.h>
 #include <setjmp.h>
-- 
2.39.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ