blob: b997389aa254aecbd7b455ddd4183943476aeb5b [file] [log] [blame]
Andrew Geissler517393d2023-01-13 08:55:19 -06001From ce7a593e74c8e0c2ece15c73e7614d4f13a19a53 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 30 Dec 2022 13:04:08 -0800
4Subject: [PATCH] Do not use LFS64 functions on linux/musl
5
6On musl, off_t is 64bit always ( even on 32bit platforms ), therefore using
7LFS64 funcitons is not needed on such platforms. Moreover, musl has stopped
8providing aliases for these functions [1] which means it wont compile on
9newer musl systems. Therefore only use it on 32bit glibc/linux platforms
10and exclude musl like cygwin or OSX
11
12[1] https://git.musl-libc.org/cgit/musl/commit/?id=246f1c811448f37a44b41cd8df8d0ef9736d95f4
13
14Upstream-Status: Submitted [https://github.com/gabime/spdlog/pull/2589]
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16---
17 include/spdlog/details/os.h | 4 +++-
18 1 file changed, 3 insertions(+), 1 deletion(-)
19
20--- a/include/spdlog/details/os-inl.h
21+++ b/include/spdlog/details/os-inl.h
22@@ -237,7 +237,7 @@ SPDLOG_INLINE size_t filesize(FILE *f)
23 int fd = ::fileno(f);
24 # endif
25 // 64 bits(but not in osx or cygwin, where fstat64 is deprecated)
26-# if (defined(__linux__) || defined(__sun) || defined(_AIX)) && (defined(__LP64__) || defined(_LP64))
27+# if ((defined(__linux__) && defined(__GLIBC__)) || defined(__sun) || defined(_AIX)) && (defined(__LP64__) || defined(_LP64))
28 struct stat64 st;
29 if (::fstat64(fd, &st) == 0)
30 {