aboutsummaryrefslogtreecommitdiffstats
path: root/main/apk-tools/0001-db-fix-regression-preventing-remounting-apk-cache-r-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/apk-tools/0001-db-fix-regression-preventing-remounting-apk-cache-r-.patch')
-rw-r--r--main/apk-tools/0001-db-fix-regression-preventing-remounting-apk-cache-r-.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/main/apk-tools/0001-db-fix-regression-preventing-remounting-apk-cache-r-.patch b/main/apk-tools/0001-db-fix-regression-preventing-remounting-apk-cache-r-.patch
new file mode 100644
index 0000000000..7d5e478b55
--- /dev/null
+++ b/main/apk-tools/0001-db-fix-regression-preventing-remounting-apk-cache-r-.patch
@@ -0,0 +1,35 @@
+From ede5165833b94051ecbc35e9ac4a359f54cc0116 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
+Date: Thu, 25 May 2017 18:04:41 +0300
+Subject: [PATCH] db: fix regression preventing remounting apk cache r/w
+
+Introduced in commit c0f2d88f342f4d185f3991f98b79ab61a03896e4.
+fstatfs is needed to inspect the mount flags.
+---
+ src/database.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/database.c b/src/database.c
+index 8230764..67cc4f5 100644
+--- a/src/database.c
++++ b/src/database.c
+@@ -1603,7 +1603,7 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts)
+
+ /* figure out where to have the cache */
+ fd = openat(db->root_fd, dbopts->cache_dir, O_RDONLY | O_CLOEXEC);
+- if (fd >= 0) {
++ if (fd >= 0 && fstatfs(fd, &stfs) == 0) {
+ db->cache_dir = dbopts->cache_dir;
+ db->cache_fd = fd;
+ db->cache_remount_flags = map_statfs_flags(stfs.f_flags);
+@@ -1622,6 +1622,7 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts)
+ }
+ }
+ } else {
++ if (fd >= 0) close(fd);
+ db->cache_dir = apk_static_cache_dir;
+ db->cache_fd = openat(db->root_fd, db->cache_dir, O_RDONLY | O_CLOEXEC);
+ }
+--
+2.13.0
+