1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-11-17 13:10:42 +01:00

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>
This commit is contained in:
Elliott Hughes
2025-11-12 20:34:01 +00:00
committed by Anastasia Klimchuk
parent c09a2f5387
commit 359c535a05

View File

@@ -10,6 +10,7 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#ifndef __LIBPAYLOAD__
#include <fcntl.h>