Skip to content

Commit

Permalink
Define _POSIX_C_SOURCE to be 200112L, as a minimum for C99.
Browse files Browse the repository at this point in the history
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 Mbed-TLS#3420

Signed-off-by: nia <[email protected]>
  • Loading branch information
alarixnia committed Jun 11, 2020
1 parent 5b66d44 commit 1c0c837
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion programs/aes/aescrypt2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion programs/aes/crypt_and_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tests/suites/main_test.function
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#if !defined(_POSIX_C_SOURCE)
#define _POSIX_C_SOURCE 1 // for fileno() from <stdio.h>
#define _POSIX_C_SOURCE 200112L // for fileno() from <stdio.h>
#endif
#endif

Expand Down

0 comments on commit 1c0c837

Please sign in to comment.