diff options
author | Timo Teräs <timo.teras@iki.fi> | 2017-02-27 11:02:16 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2017-02-27 11:05:01 +0200 |
commit | c0f2d88f342f4d185f3991f98b79ab61a03896e4 (patch) | |
tree | 95735071ae451f49d6701cc9421dda7e1bc7a801 /src | |
parent | 704694bd1daf6d58ddf831f0c1a895a84fd95c1e (diff) | |
download | apk-tools-c0f2d88f342f4d185f3991f98b79ab61a03896e4.tar.gz apk-tools-c0f2d88f342f4d185f3991f98b79ab61a03896e4.tar.bz2 apk-tools-c0f2d88f342f4d185f3991f98b79ab61a03896e4.tar.xz apk-tools-c0f2d88f342f4d185f3991f98b79ab61a03896e4.zip |
db: allow caching packages on tmpfs
fixes #5616
The original intention was not use unnecessary space on tmpfs
e.g. if the cache directory is a mount point, but accidentally
left unmounted. But there are valid cases when packages are
intentionally wanted to be cached on tmpfs. If caching is not
desired, the user can just remove the cache directory.
Diffstat (limited to 'src')
-rw-r--r-- | src/database.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/database.c b/src/database.c index 7a0bb5d..c505dba 100644 --- a/src/database.c +++ b/src/database.c @@ -1593,7 +1593,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, apk_linked_cache_dir, O_RDONLY | O_CLOEXEC); - if (fd >= 0 && fstatfs(fd, &stfs) == 0 && stfs.f_type != TMPFS_MAGIC) { + if (fd >= 0) { db->cache_dir = apk_linked_cache_dir; db->cache_fd = fd; db->cache_remount_flags = map_statfs_flags(stfs.f_flags); @@ -1612,8 +1612,6 @@ 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); } |