[Libreoffice-commits] .: tools/source unotools/source
Michael Meeks
mmeeks at kemper.freedesktop.org
Tue Dec 14 07:23:57 PST 2010
tools/source/fsys/dirent.cxx | 11 ++++-------
unotools/source/ucbhelper/tempfile.cxx | 17 +++++++++++------
2 files changed, 15 insertions(+), 13 deletions(-)
New commits:
commit 7029da9db5ab730b870abfeaaf09b3d551f4fdb8
Author: Michael Meeks <michael.meeks at novell.com>
Date: Tue Dec 14 15:20:50 2010 +0000
make tmp names recognisable, and cleans
diff --git a/tools/source/fsys/dirent.cxx b/tools/source/fsys/dirent.cxx
index 1a54b85..a1b0ebb 100644
--- a/tools/source/fsys/dirent.cxx
+++ b/tools/source/fsys/dirent.cxx
@@ -2095,20 +2095,19 @@ const DirEntry& DirEntry::SetTempNameBase( const String &rBase )
DirEntry DirEntry::TempName( DirEntryKind eKind ) const
{
// ggf. Base-Temp-Dir verwenden (macht Remote keinen Sinn => vorher)
- const DirEntry &rEntry = TempNameBase_Impl::get();
+ const DirEntry &rEntry = TempNameBase_Impl::get();
if ( !pParent && FSYS_FLAG_CURRENT != rEntry.eFlag && FSYS_FLAG_ABSROOT != eFlag )
-
{
DirEntry aFactory( rEntry );
aFactory += GetName();
return aFactory.TempName();
}
- ByteString aDirName; // hiermit hatte MPW C++ Probleme - immmer noch??
+ ByteString aDirName;
char *ret_val;
size_t i;
- // dertermine Directory, Prefix and Extension
+ // determine Directory, Prefix and Extension
char pfx[6];
char ext[5];
const char *dir;
@@ -2134,17 +2133,15 @@ DirEntry DirEntry::TempName( DirEntryKind eKind ) const
else
{
aDirName = ByteString(GetFull(), osl_getThreadTextEncoding());
- strcpy( pfx, "sv" );
+ strcpy( pfx, "lo" );
strcpy( ext, ".tmp" );
}
dir = aDirName.GetBuffer();
- // wurde kein Dir angegeben, dann nehmen wir ein passendes TEMP-Verz.
char sBuf[_MAX_PATH];
if ( eFlag == FSYS_FLAG_CURRENT || ( !pParent && pWild ) )
dir = TempDirImpl(sBuf);
- // ab hier leicht modifizierter Code von VB
DirEntry aRet(FSYS_FLAG_INVALID);
i = strlen(dir);
// need to add ?\\? + prefix + number + pid + .ext + '\0'
diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx
index f149445..799db42 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -203,7 +203,7 @@ void CreateTempName_Impl( String& rName, sal_Bool bKeep, sal_Bool bDir = sal_Tru
// ER 13.07.00 why not radix 36 [0-9A-Z] ?!?
const unsigned nRadix = 26;
String aName( rName );
- aName += String::CreateFromAscii( "sv" );
+ aName += String::CreateFromAscii( "lu" );
rName.Erase();
static unsigned long u = Time::GetSystemTicks();
@@ -216,8 +216,14 @@ void CreateTempName_Impl( String& rName, sal_Bool bKeep, sal_Bool bDir = sal_Tru
if ( bDir )
{
+#ifdef UNX /* RW permission for the user only! */
+ mode_t old_mode = umask(077);
+#endif
FileBase::RC err = Directory::create( aTmp );
- if ( err == FileBase::E_None )
+#ifdef UNX
+ umask(old_mode);
+#endif
+ if ( err == FileBase::E_None )
{
// !bKeep: only for creating a name, not a file or directory
if ( bKeep || Directory::remove( aTmp ) == FileBase::E_None )
@@ -234,13 +240,12 @@ 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);
+#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);
+ umask(old_mode);
#endif
if ( err == FileBase::E_None )
{
More information about the Libreoffice-commits
mailing list