summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-01-23 17:40:29 +0100
committerStephan Bergmann <sbergman@redhat.com>2019-01-23 21:06:31 +0100
commitbcb1969f961874ccbcef7fc042b3cc164c8d2325 (patch)
tree4f8f48eaf997e570cd203154b6a297bf54208952 /comphelper
parent45c1056fb4d05b0a8efe0b23ae21e67e68393d9c (diff)
rhbz#1667364 Open doc as R/O for which open(...,O_RDWR) returns EOPNOTSUPP
Map that EOPNOTSUPP to osl_File_E_NOSYS (and intercept it in StillReadWriteInteraction, as used by MediaDescriptor::impl_openStreamWithURL in unotools/source/misc/mediadescriptor.cxx, which will retry opening it read-only then), instead of to osl_File_E_invalidError (which lead to the "General input/output error" box). Instead of "silently" opening the doc as read-only, this still pops up a box claiming that the doc is locked by somebody else, asking whether to open it read-only or to open a copy. That's probably because of the rDescriptor.erase( utl::MediaDescriptor::PROP_READONLY() ); in TypeDetection::impl_openStream (filter/source/config/cache/typedetection.cxx) where the comment already hints at the confusion among the different read-only and locking concepts. Changing that looks like it would easily cause regressions, so is left for a follow-up commit. (And ultimately LO wouldn't need to treat the doc as read-only at all; it would just need to not attempt to open it O_RDWR upfront, and save it via copy+rename, like other apps appear to commonly do.) Change-Id: I56e18f1864084ba222acaf0e38a604082edaf4c6 Reviewed-on: https://gerrit.libreoffice.org/66805 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/source/misc/stillreadwriteinteraction.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/comphelper/source/misc/stillreadwriteinteraction.cxx b/comphelper/source/misc/stillreadwriteinteraction.cxx
index bf0ecc3fa3e2..0efec31b160b 100644
--- a/comphelper/source/misc/stillreadwriteinteraction.cxx
+++ b/comphelper/source/misc/stillreadwriteinteraction.cxx
@@ -96,6 +96,10 @@ ucbhelper::InterceptedInteraction::EInterceptionState StillReadWriteInteraction:
(exIO.Code == css::ucb::IOErrorCode_ACCESS_DENIED )
|| (exIO.Code == css::ucb::IOErrorCode_LOCKING_VIOLATION )
|| (exIO.Code == css::ucb::IOErrorCode_NOT_EXISTING )
+ // At least on Linux, a request to open some fuse-mounted file O_RDWR may fail with
+ // EOPNOTSUPP (mapped to osl_File_E_NOSYS to IOErrorCode_NOT_SUPPORTED) when opening
+ // it O_RDONLY would succeed:
+ || (exIO.Code == css::ucb::IOErrorCode_NOT_SUPPORTED )
#ifdef MACOSX
// this is a workaround for MAC, on this platform if the file is locked
// the returned error code looks to be wrong