summaryrefslogtreecommitdiff
path: root/src/shared/path-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-04-16 05:47:04 +0200
committerLennart Poettering <lennart@poettering.net>2013-04-16 05:47:04 +0200
commit6606089752df90f3eeb4924af109046f1c73554c (patch)
tree6d031dd2b3eec2f02f1a25aaa680c80ae95affd6 /src/shared/path-util.c
parentdfb33a9737e62ab872d3937b7690b252d2892fe8 (diff)
path-util: unify code for detecting OS trees
This also makes sure we always detect an OS tree the same way, by checking for /etc/os-release.
Diffstat (limited to 'src/shared/path-util.c')
-rw-r--r--src/shared/path-util.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/shared/path-util.c b/src/shared/path-util.c
index 0b50ea646a..b623fc3dd5 100644
--- a/src/shared/path-util.c
+++ b/src/shared/path-util.c
@@ -413,3 +413,15 @@ int path_is_read_only_fs(const char *path) {
return !!(st.f_flag & ST_RDONLY);
}
+
+int path_is_os_tree(const char *path) {
+ char *p;
+ int r;
+
+ /* We use /etc/os-release as flag file if something is an OS */
+
+ p = strappenda(path, "/etc/os-release");
+ r = access(p, F_OK);
+
+ return r < 0 ? 0 : 1;
+}