Commit c68b9333 authored by Steve Lhomme's avatar Steve Lhomme

contrib: libarchive: fix the missing statvfs patch

The code assumed that statfs had a f_flag field in some places (but not others)
but it's in fact it's f_flags.

Android compiles fine with this patch (and all other targets in Gitlab CI)
parent dd7c2106
Pipeline #15791 passed with stage
in 91 minutes and 19 seconds
From a189efa30ad57c874997dc3ea2a3cef402b6a4ea Mon Sep 17 00:00:00 2001
From: Thomas Guillem <thomas@gllm.fr>
Date: Fri, 22 May 2015 14:44:28 +0200
Subject: [PATCH] Fix build failure without STATVFS
From f8dc2ab55524be0cad81292f1939252bca2ad525 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Fri, 3 Apr 2020 08:33:02 +0200
Subject: [PATCH] fix f_flag usage in statfs
statfs has a f_flags field, not f_flag [1]
statvfs is the one with the f_flag field [2]
Some Android NDKs don't have statvfs but do have statvfs.
[1] https://github.com/torvalds/linux/blob/master/fs/statfs.c
[2] http://man7.org/linux/man-pages/man3/statvfs.3.html
---
libarchive/archive_read_disk_posix.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
libarchive/archive_read_disk_posix.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libarchive/archive_read_disk_posix.c b/libarchive/archive_read_disk_posix.c
index a13dbbf..b93c198 100644
index 52fec7bb..ae11cd34 100644
--- a/libarchive/archive_read_disk_posix.c
+++ b/libarchive/archive_read_disk_posix.c
@@ -1640,7 +1640,9 @@ setup_current_filesystem(struct archive_read_disk *a)
}
@@ -1840,7 +1840,7 @@ setup_current_filesystem(struct archive_read_disk *a)
#if defined(HAVE_STATVFS)
if (svfs.f_flag & ST_NOATIME)
#else
- if (sfs.f_flag & ST_NOATIME)
+ if (sfs.f_flags & ST_NOATIME)
#endif
t->current_filesystem->noatime = 1;
else
@@ -1925,7 +1925,7 @@ setup_current_filesystem(struct archive_read_disk *a)
}
#elif defined(HAVE_SYS_STATFS_H) && defined(HAVE_LINUX_MAGIC_H) &&\
- defined(HAVE_STATFS) && defined(HAVE_FSTATFS)
+ defined(HAVE_STATFS) && defined(HAVE_FSTATFS) &&\
+ defined(HAVE_SYS_STATVFS_H) &&\
+ (defined(HAVE_STATVFS) || defined(HAVE_FSTATVFS))
/*
* Note: statfs is deprecated since LSB 3.2
*/
#if defined(ST_NOATIME)
- if (sfs.f_flag & ST_NOATIME)
+ if (sfs.f_flags & ST_NOATIME)
t->current_filesystem->noatime = 1;
else
#endif
--
2.1.4
2.26.0.windows.1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment