db: fix regression preventing remounting apk cache r/w
Introduced in commit c0f2d88f34
.
fstatfs is needed to inspect the mount flags.
cute-signatures
parent
b4b95e9ae7
commit
ede5165833
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue