summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2005-04-18 13:36:48 +0000
committerOliver Bolte <obo@openoffice.org>2005-04-18 13:36:48 +0000
commit39c58e416252571a04b8ebbb56c9fa012b117993 (patch)
treedc71e8a6940a6b6fef0ac640864c03c367ca9bdd
parentb62608e012642b4cfe45f8505bd1cc2251181645 (diff)
INTEGRATION: CWS olefix (1.18.32); FILE MERGED
2005/04/06 15:01:38 mav 1.18.32.1: #i46469# use correct umask on unix
-rw-r--r--unotools/source/ucbhelper/tempfile.cxx29
1 files changed, 27 insertions, 2 deletions
diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx
index 658c4a86f3fe..2eac6f0927d6 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: tempfile.cxx,v $
*
- * $Revision: 1.20 $
+ * $Revision: 1.21 $
*
- * last change: $Author: obo $ $Date: 2005-04-18 12:14:56 $
+ * last change: $Author: obo $ $Date: 2005-04-18 14:36:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -74,6 +74,10 @@
#include <tools/debug.hxx>
#include <stdio.h>
+#ifdef UNX
+#include <sys/stat.h>
+#endif
+
using namespace osl;
namespace
@@ -126,7 +130,14 @@ sal_Bool ensuredir( const rtl::OUString& rUnqPath )
// HACK: create directory on a mount point with nobrowse option
// returns ENOSYS in any case !!
osl::Directory aDirectory( aPath );
+#ifdef UNX
+/* RW permission for the user only! */
+ mode_t old_mode = umask(077);
+#endif
osl::FileBase::RC nError = aDirectory.open();
+#ifdef UNX
+umask(old_mode);
+#endif
aDirectory.close();
if( nError == osl::File::E_None )
return sal_True;
@@ -256,7 +267,14 @@ void CreateTempName_Impl( String& rName, sal_Bool bKeep, sal_Bool bDir = sal_Tru
{
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);
+#ifdef UNX
+umask(old_mode);
+#endif
if ( err == FileBase::E_None )
{
rName = aTmp;
@@ -334,7 +352,14 @@ TempFile::TempFile( const String& rLeadingChars, const String* pExtension, const
else
{
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);
+#ifdef UNX
+umask(old_mode);
+#endif
if ( err == FileBase::E_None )
{
pImp->aName = aTmp;