efivar: fix compilation with musl 1.2.4
[feed/packages.git] / libs / efivar / patches / 003-Use-off_t-instead-of-off64_t.patch
1 From 914c686cc54b2405dab08bff77cd60827aab54b1 Mon Sep 17 00:00:00 2001
2 From: Khem Raj <raj.khem@gmail.com>
3 Date: Wed, 14 Dec 2022 16:55:51 -0800
4 Subject: [PATCH] Use off_t instead of off64_t
5
6 Pass _FILE_OFFSET_BITS=64 to ensure 64bit off_t
7
8 This helps building efivar for 32bit arches on systems using musl C
9 library. It works with glibc since _GNU_SOURCE defines
10 _LARGEFILE64_SOURCE as well, this feature test macro enables the 64bit
11 interfaces which were done as intermediate steps when transition to
12 66-bit off_t was done as part olf LFS64 support.
13
14 Signed-off-by: Khem Raj <raj.khem@gmail.com>
15 ---
16 src/error.c | 2 +-
17 src/include/defaults.mk | 1 +
18 2 files changed, 2 insertions(+), 1 deletion(-)
19
20 --- a/src/error.c
21 +++ b/src/error.c
22 @@ -191,7 +191,7 @@ dbglog_write(void *cookie, const char *b
23 }
24
25 static int
26 -dbglog_seek(void *cookie UNUSED, off64_t *offset, int whence)
27 +dbglog_seek(void *cookie UNUSED, off_t *offset, int whence)
28 {
29 FILE *log = efi_errlog ? efi_errlog : stderr;
30 int rc;
31 --- a/src/include/defaults.mk
32 +++ b/src/include/defaults.mk
33 @@ -34,6 +34,7 @@ CPPFLAGS ?=
34 override _CPPFLAGS := $(CPPFLAGS)
35 override CPPFLAGS = $(_CPPFLAGS) -DLIBEFIVAR_VERSION=$(VERSION) \
36 -D_GNU_SOURCE \
37 + -D_FILE_OFFSET_BITS=64 \
38 -I$(TOPDIR)/src/include/
39 CFLAGS ?= $(OPTIMIZE) $(DEBUGINFO) $(WARNINGS) $(ERRORS)
40 CFLAGS_GCC ?= -specs=$(TOPDIR)/src/include/gcc.specs \