diff options
author | Tor Lillqvist <tml@iki.fi> | 2013-08-24 22:01:18 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2013-08-25 00:29:18 +0300 |
commit | fa9ef668fb8b0abfdf85d641048580fa7c2fee3e (patch) | |
tree | 44ec2474ab4842628c4906ae20cf1e1397b73d30 /sal/osl/unx/file.cxx | |
parent | 2599bc9d6723daee921e3bf65124928bf56c8241 (diff) |
More work on a sandboxed LibreOffice on OS X
In particular, surround also the ftruncate() operation that
osl_setFileSize() does with access through a security scope bookmark
for the file, if available. This fixes file saving in a sandboxed
LibreOffice. (But oh boy, does simply saving an ODT document go though
a weird dance of file operations.)
Luckily the C++ oslFileHandle abstraction keeps the pathname that the
file was opened with, so even if ftruncate() as such takes only the
file descriptor, we can get at the pathname to retrieve our security
scope bookmark.
Change-Id: I8acb1b2f3fb3ec0cea833697b7f1d4a1912ed551
Diffstat (limited to 'sal/osl/unx/file.cxx')
-rw-r--r-- | sal/osl/unx/file.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx index 9ed1892dc031..a0ef50eae0e7 100644 --- a/sal/osl/unx/file.cxx +++ b/sal/osl/unx/file.cxx @@ -307,7 +307,7 @@ sal_uInt64 FileHandle_Impl::getSize() const oslFileError FileHandle_Impl::setSize (sal_uInt64 uSize) { off_t const nSize = sal::static_int_cast< off_t >(uSize); - if (-1 == ftruncate (m_fd, nSize)) + if (-1 == ftruncate_with_name (m_fd, nSize, m_strFilePath)) { /* Failure. Save original result. Try fallback algorithm */ oslFileError result = oslTranslateFileError (OSL_FET_ERROR, errno); |