From 38897f7df4ef71fef5b074a177338b35ae314d29 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 13 Jun 2012 15:09:40 +0000 Subject: [PATCH] add use of access(2) to filesystem exists_and_is_writable() implementation, to pick up filesystems mounted read-only git-svn-id: svn://localhost/ardour2/branches/3.0@12701 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/pbd/filesystem.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libs/pbd/filesystem.cc b/libs/pbd/filesystem.cc index 819a044a7b..344252f4ba 100644 --- a/libs/pbd/filesystem.cc +++ b/libs/pbd/filesystem.cc @@ -111,6 +111,13 @@ exists_and_writable (const path & p) /* exists and is not writable */ return false; } + /* filesystem may be mounted read-only, so even though file + * permissions permit access, the mount status does not. + * access(2) seems like the best test for this. + */ + if (g_access (p.to_string().c_str(), W_OK) != 0) { + return false; + } } return true;