summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-08-18 23:15:51 +0200
committerLennart Poettering <lennart@poettering.net>2014-08-18 23:16:36 +0200
commit70421bdce2719d76efffd8afdc28433c75aac5a2 (patch)
tree47f80d53b4d1ff73610d9180b53ee2b81f66cb55 /src
parent3f3cc397043e69c9e9a690194a6a1043bf6466c5 (diff)
util: try to be a bit more NFS compatible when checking whether an FS is writable
https://bugs.freedesktop.org/show_bug.cgi?id=81169
Diffstat (limited to 'src')
-rw-r--r--src/shared/path-util.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/shared/path-util.c b/src/shared/path-util.c
index 57554cd294..67566bc76b 100644
--- a/src/shared/path-util.c
+++ b/src/shared/path-util.c
@@ -533,7 +533,16 @@ int path_is_read_only_fs(const char *path) {
if (statvfs(path, &st) < 0)
return -errno;
- return !!(st.f_flag & ST_RDONLY);
+ 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) {