diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 4ee24e90f7..dc26e254cf 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,12 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-08-11 12:01 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * source/rtl/fstemp.c + ! Fixed regression in hb_fsCreateTemp() after 2009-08-07 11:55 UTC+0200 + where temp files couldn't be opened, instead a lot of temp filenames + were created. + 2009-08-11 11:14 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/hbtpathy/telepath.prg ! fixed tp_inkey() to not freeze when called without parameter diff --git a/harbour/source/rtl/fstemp.c b/harbour/source/rtl/fstemp.c index edafd10e19..8afb3326e5 100644 --- a/harbour/source/rtl/fstemp.c +++ b/harbour/source/rtl/fstemp.c @@ -267,13 +267,19 @@ HB_FHANDLE hb_fsCreateTemp( const char * pszDir, const char * pszPrefix, ULONG u { if( hb_fsTempName( pszName, pszDir, pszPrefix ) ) { - HB_FHANDLE fhnd = hb_fsCreateEx( pszName, ulAttr, FO_EXCLUSIVE | FO_EXCL ); +#if defined( HB_OS_WIN ) + /* Using FO_TRUNC on win platforms as hb_fsTempName() uses GetTempFileName(), + which creates the file, so FO_EXCL would fail at this point. [vszakats] */ + HB_FHANDLE fhnd = hb_fsCreateEx( pszName, ulAttr, FO_EXCLUSIVE | FO_TRUNC ); +#else + HB_FHANDLE fhnd = hb_fsCreateEx( pszName, ulAttr, FO_EXCLUSIVE | FO_EXCL ); +#endif - /* This function may fail, if the generated filename got - used between generation and the file creation. */ + /* This function may fail, if the generated filename got + used between generation and the file creation. */ - if( fhnd != FS_ERROR ) - return fhnd; + if( fhnd != FS_ERROR ) + return fhnd; } else { @@ -285,7 +291,8 @@ HB_FHANDLE hb_fsCreateTemp( const char * pszDir, const char * pszPrefix, ULONG u return FS_ERROR; } -#else + +#else /* HB_OS_UNIX */ HB_FHANDLE hb_fsCreateTemp( const char * pszDir, const char * pszPrefix, ULONG ulAttr, char * pszName ) {