summaryrefslogtreecommitdiff
path: root/src/database.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-03-16 13:18:54 +0200
committerTimo Teräs <timo.teras@iki.fi>2011-03-16 14:56:13 +0200
commit15badbfd975b2a898acaacfc943e4df2cb1c7864 (patch)
treeac156ff1adc5a138b9f51f8d3d277a58b8f7a807 /src/database.c
parentca85bcb7bd3fccbf361e7e97c0dc3df12e4b5943 (diff)
downloadapk-tools-15badbfd975b2a898acaacfc943e4df2cb1c7864.tar.gz
apk-tools-15badbfd975b2a898acaacfc943e4df2cb1c7864.tar.bz2
apk-tools-15badbfd975b2a898acaacfc943e4df2cb1c7864.tar.xz
apk-tools-15badbfd975b2a898acaacfc943e4df2cb1c7864.zip
db: detect tmpfs better
Use statfs() filesystem type, instead of the device IDs.
Diffstat (limited to 'src/database.c')
-rw-r--r--src/database.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/database.c b/src/database.c
index 53a18c7..eea852a 100644
--- a/src/database.c
+++ b/src/database.c
@@ -19,6 +19,7 @@
#include <stdlib.h>
#include <signal.h>
#include <fnmatch.h>
+#include <sys/vfs.h>
#include <sys/file.h>
#include <sys/stat.h>
@@ -1061,6 +1062,7 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts)
struct apk_repository_list *repo = NULL;
struct apk_bstream *bs;
struct stat64 st;
+ struct statfs stfs;
apk_blob_t blob;
int r, rr = 0;
@@ -1096,7 +1098,8 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts)
msg = "Unable to open root";
goto ret_errno;
}
- if (fstat64(db->root_fd, &st) != 0 || major(st.st_dev) == 0)
+ if (fstatfs(db->root_fd, &stfs) == 0 &&
+ stfs.f_type == 0x01021994 /* TMPFS_MAGIC */)
db->permanent = 0;
if (fstatat64(db->root_fd, apk_linked_cache_dir, &st, 0) == 0 &&