1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-11-17 13:10:42 +01:00
Files
flashrom/helpers_fileio.c
Elliott Hughes 359c535a05 helpers_fileio.c: fix fsync() check.
Both the _POSIX_FSYNC macro and the fsync() declaration are in
<unistd.h>. The current code works by accident on glibc courtesy of
transitive includes, but is broken in Android currently (mistakenly
assuming there is no fsync() because _POSIX_FSYNC isn't defined, merely
because <unistd.h> hasn't been included), and won't compile with Android's
C23 addition of call_once() to <stdlib.h> because _POSIX_FSYNC comes in
transitively via <limits.h> but without <unistd.h> for the fsync()
declaration.

Fix all of this by just including the right POSIX header file for both
the feature macro and the function declaration.

Change-Id: Ifd6eeba56cffabb6a37880c78ea21de4705308b5
Signed-off-by: Elliott Hughes <enh@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/90015
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-11-17 00:29:32 +00:00

3.0 KiB