summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/osl/detail/file.h3
-rw-r--r--sal/osl/unx/file.cxx9
-rw-r--r--unotools/source/ucbhelper/tempfile.cxx12
3 files changed, 12 insertions, 12 deletions
diff --git a/include/osl/detail/file.h b/include/osl/detail/file.h
index 96d880727d8e..ee5a172920ad 100644
--- a/include/osl/detail/file.h
+++ b/include/osl/detail/file.h
@@ -19,10 +19,11 @@
*/
/* More flags needed for semantics that match the open() call that
- used to be in SvFileStream::Open().
+ used to be in SvFileStream::Open(), and for temp files:
*/
#define osl_File_OpenFlag_Trunc 0x00000010L
#define osl_File_OpenFlag_NoExcl 0x00000020L
+#define osl_File_OpenFlag_Private 0x00000040L
/** @endcond */
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index e781574cab15..a7eaac15e1f8 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -853,16 +853,19 @@ openFilePath( const char *cpFilePath, oslFileHandle* pHandle, sal_uInt32 uFlags,
#endif
/* set mode and flags */
- int defmode = S_IRUSR | S_IRGRP | S_IROTH;
+ int defmode = uFlags & osl_File_OpenFlag_Private
+ ? S_IRUSR : S_IRUSR | S_IRGRP | S_IROTH;
int flags = O_RDONLY;
if (uFlags & osl_File_OpenFlag_Write)
{
- defmode |= S_IWUSR | S_IWGRP | S_IWOTH;
+ defmode |= uFlags & osl_File_OpenFlag_Private
+ ? S_IWUSR : S_IWUSR | S_IWGRP | S_IWOTH;
flags = OPEN_WRITE_FLAGS;
}
if (uFlags & osl_File_OpenFlag_Create)
{
- defmode |= S_IWUSR | S_IWGRP | S_IWOTH;
+ defmode |= uFlags & osl_File_OpenFlag_Private
+ ? S_IWUSR : S_IWUSR | S_IWGRP | S_IWOTH;
flags = OPEN_CREATE_FLAGS;
}
if (mode == mode_t(-1))
diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx
index 8d4152cf2100..5b9cae784b66 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -29,6 +29,7 @@
#include <ucbhelper/fileidentifierconverter.hxx>
#include <rtl/ustring.hxx>
#include <rtl/instance.hxx>
+#include <osl/detail/file.h>
#include <osl/file.hxx>
#include <tools/time.hxx>
#include <tools/debug.hxx>
@@ -258,14 +259,9 @@ OUString lcl_createName(
{
DBG_ASSERT( bKeep, "Too expensive, use directory for creating name!" );
File aFile( aTmp );
-#ifdef UNX
- /* RW permission for the user only! */
- mode_t old_mode = umask(077);
-#endif
- FileBase::RC err = aFile.open(osl_File_OpenFlag_Create | (bLock ? 0 : osl_File_OpenFlag_NoLock));
-#ifdef UNX
- umask(old_mode);
-#endif
+ FileBase::RC err = aFile.open(
+ osl_File_OpenFlag_Create | osl_File_OpenFlag_Private
+ | (bLock ? 0 : osl_File_OpenFlag_NoLock));
if ( err == FileBase::E_None || (bLock && err == FileBase::E_NOLCK) )
{
aFile.close();