diff --git a/doc/xml/release.xml b/doc/xml/release.xml
index 586fb301a..3605db1e6 100644
--- a/doc/xml/release.xml
+++ b/doc/xml/release.xml
@@ -55,6 +55,10 @@
Require S3 key options except for local/remote commands.
+
+ Explicitly compile with Posix 2001 standard.
+
+
Add ServiceError for errors from a service that can be retried.
diff --git a/libc/Makefile.PL b/libc/Makefile.PL
index d87f1dd68..266a37265 100644
--- a/libc/Makefile.PL
+++ b/libc/Makefile.PL
@@ -113,6 +113,7 @@ WriteMakefile
-Wfatal-errors -Wall -Wextra -Wwrite-strings -Wno-clobbered -Wno-missing-field-initializers
-o $@
-std=c99
+ -D_POSIX_C_SOURCE=200112L
-D_FILE_OFFSET_BITS=64
`xml2-config --cflags`
)),
diff --git a/src/Makefile b/src/Makefile
index bb7114b02..4044af398 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -7,8 +7,8 @@
####################################################################################################################################
CC=gcc
-# Compile using C99 standard
-CSTD = -std=c99
+# Compile using C99 and Posix 2001 standards
+CSTD = -std=c99 -D_POSIX_C_SOURCE=200112L
# Compile optimizations
COPT = -O2
diff --git a/src/storage/driver/posix/common.c b/src/storage/driver/posix/common.c
index 8c43d6f83..460612b14 100644
--- a/src/storage/driver/posix/common.c
+++ b/src/storage/driver/posix/common.c
@@ -1,11 +1,6 @@
/***********************************************************************************************************************************
Posix Common File Routines
***********************************************************************************************************************************/
-// So fsync() will work on older glib versions
-#ifndef _POSIX_C_SOURCE
- #define _POSIX_C_SOURCE 200112L
-#endif
-
#include
#include
diff --git a/src/storage/driver/posix/storage.c b/src/storage/driver/posix/storage.c
index 339f2fe0a..7cf339049 100644
--- a/src/storage/driver/posix/storage.c
+++ b/src/storage/driver/posix/storage.c
@@ -1,11 +1,6 @@
/***********************************************************************************************************************************
Posix Storage Driver
***********************************************************************************************************************************/
-// So lstat() will work on older glib versions
-#ifndef _POSIX_C_SOURCE
- #define _POSIX_C_SOURCE 200112L
-#endif
-
#include
#include
#include
diff --git a/test/lib/pgBackRestTest/Common/JobTest.pm b/test/lib/pgBackRestTest/Common/JobTest.pm
index d1c5e979a..16302772b 100644
--- a/test/lib/pgBackRestTest/Common/JobTest.pm
+++ b/test/lib/pgBackRestTest/Common/JobTest.pm
@@ -383,7 +383,8 @@ sub run
# Flags that are common to all builds
my $strCommonFlags =
- '-I. -Itest -std=c99 -fPIC -g -Wno-clobbered `perl -MExtUtils::Embed -e ccopts` -DWITH_PERL' .
+ '-I. -Itest -std=c99 -fPIC -g -Wno-clobbered -D_POSIX_C_SOURCE=200112L' .
+ ' `perl -MExtUtils::Embed -e ccopts` -DWITH_PERL' .
' `xml2-config --cflags`' . ($self->{bProfile} ? " -pg" : '') .
($self->{oTest}->{&TEST_DEBUG_UNIT_SUPPRESS} ? '' : " -DDEBUG_UNIT") .
(vmWithBackTrace($self->{oTest}->{&TEST_VM}) && $self->{bBackTrace} ? ' -DWITH_BACKTRACE' : '') .