From 1c0c837ddc997fab9dd4480d52a06576a6c1fff0 Mon Sep 17 00:00:00 2001 From: nia Date: Thu, 11 Jun 2020 12:03:45 +0100 Subject: [PATCH 1/2] Define _POSIX_C_SOURCE to be 200112L, as a minimum for C99. Strict platforms cannot be expected to accept C99 code as valid when earlier standards versions are selected. This helps the programs build on Solaris-like platforms (e.g. illumos). Fixes #3420 Signed-off-by: nia --- programs/aes/aescrypt2.c | 2 +- programs/aes/crypt_and_hash.c | 2 +- tests/suites/main_test.function | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/programs/aes/aescrypt2.c b/programs/aes/aescrypt2.c index f17c641b0..b0c1feaff 100644 --- a/programs/aes/aescrypt2.c +++ b/programs/aes/aescrypt2.c @@ -22,7 +22,7 @@ /* Enable definition of fileno() even when compiling with -std=c99. Must be * set before config.h, which pulls in glibc's features.h indirectly. * Harmless on other platforms. */ -#define _POSIX_C_SOURCE 1 +#define _POSIX_C_SOURCE 200112L #if !defined(MBEDTLS_CONFIG_FILE) #include "mbedtls/config.h" diff --git a/programs/aes/crypt_and_hash.c b/programs/aes/crypt_and_hash.c index 1e03d43ae..5c7048045 100644 --- a/programs/aes/crypt_and_hash.c +++ b/programs/aes/crypt_and_hash.c @@ -23,7 +23,7 @@ /* Enable definition of fileno() even when compiling with -std=c99. Must be * set before config.h, which pulls in glibc's features.h indirectly. * Harmless on other platforms. */ -#define _POSIX_C_SOURCE 1 +#define _POSIX_C_SOURCE 200112L #if !defined(MBEDTLS_CONFIG_FILE) #include "mbedtls/config.h" diff --git a/tests/suites/main_test.function b/tests/suites/main_test.function index ff4cf2015..e56191a4c 100644 --- a/tests/suites/main_test.function +++ b/tests/suites/main_test.function @@ -21,7 +21,7 @@ #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) #if !defined(_POSIX_C_SOURCE) -#define _POSIX_C_SOURCE 1 // for fileno() from +#define _POSIX_C_SOURCE 200112L // for fileno() from #endif #endif From ecef1ddd5be76b0b5a4571d0db5440915c55a4e0 Mon Sep 17 00:00:00 2001 From: nia Date: Thu, 11 Jun 2020 18:43:48 +0100 Subject: [PATCH 2/2] Add ChangeLog.d entry for PR3421 Signed-off-by: nia --- ChangeLog.d/bugfix_PR3421.txt | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 ChangeLog.d/bugfix_PR3421.txt diff --git a/ChangeLog.d/bugfix_PR3421.txt b/ChangeLog.d/bugfix_PR3421.txt new file mode 100644 index 000000000..b52dee00f --- /dev/null +++ b/ChangeLog.d/bugfix_PR3421.txt @@ -0,0 +1,2 @@ +Bugfix + * Set _POSIX_C_SOURCE to at least 200112L in C99 code. Reported in #3420 and fix submitted in #3421 by Nia Alarie.