summaryrefslogtreecommitdiff
path: root/src/basic/path-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-10-26 22:01:44 +0100
committerLennart Poettering <lennart@poettering.net>2015-10-27 13:25:56 +0100
commit8fcde01280adcbd07e8205b91ac52b06305b6208 (patch)
treea46fef820ed52d2f3f02652cbe09fa95721f46da /src/basic/path-util.c
parentf3e2e81d5385b9ffd84ed110d00eb347ec0e14f1 (diff)
util-lib: split stat()/statfs()/stavfs() related calls into stat-util.[ch]
Diffstat (limited to 'src/basic/path-util.c')
-rw-r--r--src/basic/path-util.c38
1 files changed, 1 insertions, 37 deletions
diff --git a/src/basic/path-util.c b/src/basic/path-util.c
index 256a98f3e6..3783129f69 100644
--- a/src/basic/path-util.c
+++ b/src/basic/path-util.c
@@ -41,6 +41,7 @@
#include "missing.h"
#include "parse-util.h"
#include "path-util.h"
+#include "stat-util.h"
#include "string-util.h"
#include "strv.h"
#include "util.h"
@@ -455,43 +456,6 @@ char* path_join(const char *root, const char *path, const char *rest) {
NULL);
}
-int path_is_read_only_fs(const char *path) {
- struct statvfs st;
-
- assert(path);
-
- if (statvfs(path, &st) < 0)
- return -errno;
-
- if (st.f_flag & ST_RDONLY)
- return true;
-
- /* On NFS, statvfs() might not reflect whether we can actually
- * write to the remote share. Let's try again with
- * access(W_OK) which is more reliable, at least sometimes. */
- if (access(path, W_OK) < 0 && errno == EROFS)
- return true;
-
- return false;
-}
-
-int path_is_os_tree(const char *path) {
- char *p;
- int r;
-
- /* We use /usr/lib/os-release as flag file if something is an OS */
- p = strjoina(path, "/usr/lib/os-release");
- r = access(p, F_OK);
- if (r >= 0)
- return 1;
-
- /* Also check for the old location in /etc, just in case. */
- p = strjoina(path, "/etc/os-release");
- r = access(p, F_OK);
-
- return r >= 0;
-}
-
int find_binary(const char *name, char **ret) {
int last_error, r;
const char *p;