X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Fpath-util.c;h=67566bc76b2c8a0ad54b357ea41c0ad3736b49f2;hb=fedfcdee6f55c3f183752b7fac4879bf41eed60b;hp=57554cd294613eed7068c6a978edb0f01149f768;hpb=a2a5291b3f5ab6ed4c92f51d0fd10a03047380d8;p=elogind.git diff --git a/src/shared/path-util.c b/src/shared/path-util.c index 57554cd29..67566bc76 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) {