From 25786d356ac391124489f2e55690281c03fa83db Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 22 Dec 2022 00:30:55 -0800
Subject: [PATCH] Replace lstat64/stat64 functions on linux

we define -D_FILE_OFFSET_BITS=64 which means lstat is operating on 64bit
off_t and is same as lstat64, same for stat and stat64 case.

This fixes build with musl where off_t has always been 64bit

Upstream-Status: Submitted [https://gn-review.googlesource.com/c/gn/+/14960]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 src/base/files/file.h             | 2 +-
 src/base/files/file_posix.cc      | 2 +-
 src/base/files/file_util_posix.cc | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/base/files/file.h b/src/base/files/file.h
index 2c94eb4e..99e87ed9 100644
--- a/src/base/files/file.h
+++ b/src/base/files/file.h
@@ -23,7 +23,7 @@ namespace base {
 
 #if defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL) || \
     defined(OS_HAIKU) || defined(OS_MSYS) || defined(OS_ZOS) ||  \
-    defined(OS_ANDROID) && __ANDROID_API__ < 21
+    defined(OS_LINUX) || defined(OS_ANDROID) && __ANDROID_API__ < 21
 typedef struct stat stat_wrapper_t;
 #elif defined(OS_POSIX) || defined(OS_FUCHSIA)
 typedef struct stat64 stat_wrapper_t;
diff --git a/src/base/files/file_posix.cc b/src/base/files/file_posix.cc
index b1f9f5e8..049568f0 100644
--- a/src/base/files/file_posix.cc
+++ b/src/base/files/file_posix.cc
@@ -26,7 +26,7 @@ namespace {
 
 #if defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL) || \
     defined(OS_HAIKU) || defined(OS_MSYS) || defined(OS_ZOS) || \
-    defined(OS_ANDROID) && __ANDROID_API__ < 21
+    defined(OS_LINUX) || defined(OS_ANDROID) && __ANDROID_API__ < 21
 int CallFstat(int fd, stat_wrapper_t* sb) {
   return fstat(fd, sb);
 }
diff --git a/src/base/files/file_util_posix.cc b/src/base/files/file_util_posix.cc
index aa54731d..53be3d3b 100644
--- a/src/base/files/file_util_posix.cc
+++ b/src/base/files/file_util_posix.cc
@@ -61,7 +61,7 @@ namespace {
 
 #if defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL) || \
     defined(OS_HAIKU) || defined(OS_MSYS) || defined(OS_ZOS) ||  \
-    defined(OS_ANDROID) && __ANDROID_API__ < 21
+    defined(OS_LINUX) || defined(OS_ANDROID) && __ANDROID_API__ < 21
 int CallStat(const char* path, stat_wrapper_t* sb) {
   return stat(path, sb);
 }
-- 
2.39.0

