[php-src] master: stream: Fix MacOS build. fsync as alias for fdatasync. (#6882)
| From: | David CARLIER via GitHub | Date: | Wed, 21 Apr 2021 14:21:39 +0000 |
| Subject: | [php-src] master: stream: Fix MacOS build. fsync as alias for fdatasync. (#6882) | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-115728@lists.php.net to get a copy of this message | ||
Author: David CARLIER (devnexen)
Committer: GitHub (web-flow)
Pusher: nikic
Date: 2021-04-21T16:21:43+02:00
Commit: https://github.com/php/php-src/commit/7aba6de1d02e445ce4a6088c2af4ce327bd67bd6
Raw diff: https://github.com/php/php-src/commit/7aba6de1d02e445ce4a6088c2af4ce327bd67bd6.diff
stream: Fix MacOS build. fsync as alias for fdatasync. (#6882)
If fdatasync is not available, use fsync instead.
For some reason, fdatasync is available when using clang from Xcode, even though no declaration is
present in headers.
Changed paths:
M configure.ac
M main/streams/plain_wrapper.c
Diff:
diff --git a/configure.ac b/configure.ac
index b358a666a751..eaf38d5497ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -548,6 +548,7 @@ asctime_r \
chroot \
ctime_r \
explicit_memset \
+fdatasync \
flock \
ftok \
funopen \
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index 1fdafa8b933c..86adb9c91beb 100644
--- a/main/streams/plain_wrapper.c
+++ b/main/streams/plain_wrapper.c
@@ -58,6 +58,9 @@ extern int php_get_gid_by_name(const char *name, gid_t *gid);
#define fdatasync fsync
#else
# define PLAIN_WRAP_BUF_SIZE(st) (st)
+# if !defined(HAVE_FDATASYNC)
+# define fdatasync fsync
+# endif
#endif
/* parse standard "fopen" modes into open() flags */