diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 9df2b1f7a4..ba7dfe9b45 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,15 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-08-07 11:55 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * source/rtl/filesys.c + ! Fixed FO_EXCL flag on win/wce platforms. It was ignored before. + % Deleted some unnecessary casts. + + * contrib/hbtip/log.prg + ! Fixed to avoid infinite loops when trying to create log files + on a non-existing path. + 2009-08-07 11:11 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbtip/Makefile + contrib/hbtip/log.prg diff --git a/harbour/contrib/hbtip/log.prg b/harbour/contrib/hbtip/log.prg index 23b7435974..10bcc364ab 100644 --- a/harbour/contrib/hbtip/log.prg +++ b/harbour/contrib/hbtip/log.prg @@ -97,7 +97,8 @@ METHOD Add( cMsg ) CLASS TIPLOG n := 1 DO WHILE .T. ::fhnd := hb_FCreate( hb_FNameMerge( cDir, cName + "-" + hb_ntos( n ), cExt ), NIL, FO_EXCL ) - IF ::fhnd != F_ERROR + IF ::fhnd != F_ERROR .OR. ; + FError() == 3 /* path not found */ EXIT ENDIF n++ diff --git a/harbour/source/rtl/filesys.c b/harbour/source/rtl/filesys.c index 0143331ec6..b9caf50904 100644 --- a/harbour/source/rtl/filesys.c +++ b/harbour/source/rtl/filesys.c @@ -320,7 +320,7 @@ static void convert_open_flags( BOOL fCreate, ULONG ulAttr, USHORT uiFlags, { if( fCreate ) { - *dwCreat = CREATE_ALWAYS; + *dwCreat = ( uiFlags & FO_EXCL ) ? CREATE_NEW : CREATE_ALWAYS; *dwMode = GENERIC_READ | GENERIC_WRITE; } else @@ -335,13 +335,9 @@ static void convert_open_flags( BOOL fCreate, ULONG ulAttr, USHORT uiFlags, *dwCreat = OPEN_ALWAYS; } else if( uiFlags & FO_TRUNC ) - { *dwCreat = TRUNCATE_EXISTING; - } else - { *dwCreat = OPEN_EXISTING; - } *dwMode = 0; switch( uiFlags & ( FO_READ | FO_WRITE | FO_READWRITE ) ) @@ -664,8 +660,7 @@ HB_FHANDLE hb_fsOpen( const char * pFilename, USHORT uiFlags ) convert_open_flags( FALSE, FC_NORMAL, uiFlags, &dwMode, &dwShare, &dwCreat, &dwAttr ); hb_vmUnlock(); - hFile = ( HANDLE ) CreateFileA( pFilename, dwMode, dwShare, - NULL, dwCreat, dwAttr, NULL ); + hFile = CreateFileA( pFilename, dwMode, dwShare, NULL, dwCreat, dwAttr, NULL ); hb_fsSetIOError( hFile != ( HANDLE ) INVALID_HANDLE_VALUE, 0 ); hb_vmLock(); @@ -724,8 +719,7 @@ HB_FHANDLE hb_fsCreate( const char * pFilename, ULONG ulAttr ) convert_open_flags( TRUE, ulAttr, FO_EXCLUSIVE, &dwMode, &dwShare, &dwCreat, &dwAttr ); hb_vmUnlock(); - hFile = ( HANDLE ) CreateFileA( pFilename, dwMode, dwShare, - NULL, dwCreat, dwAttr, NULL ); + hFile = CreateFileA( pFilename, dwMode, dwShare, NULL, dwCreat, dwAttr, NULL ); hb_fsSetIOError( hFile != ( HANDLE ) INVALID_HANDLE_VALUE, 0 ); hb_vmLock(); @@ -784,8 +778,7 @@ HB_FHANDLE hb_fsCreateEx( const char * pFilename, ULONG ulAttr, USHORT uiFlags ) convert_open_flags( TRUE, ulAttr, uiFlags, &dwMode, &dwShare, &dwCreat, &dwAttr ); hb_vmUnlock(); - hFile = ( HANDLE ) CreateFileA( pFilename, dwMode, dwShare, - NULL, dwCreat, dwAttr, NULL ); + hFile = CreateFileA( pFilename, dwMode, dwShare, NULL, dwCreat, dwAttr, NULL ); hb_fsSetIOError( hFile != ( HANDLE ) INVALID_HANDLE_VALUE, 0 ); hb_vmLock(); @@ -1895,7 +1888,7 @@ void hb_fsCommit( HB_FHANDLE hFileHandle ) { hb_vmUnlock(); #if defined( HB_IO_WIN ) - hb_fsSetIOError( FlushFileBuffers( ( HANDLE ) DosToWinHandle( hFileHandle ) ), 0 ); + hb_fsSetIOError( FlushFileBuffers( DosToWinHandle( hFileHandle ) ), 0 ); #else #if defined( __WATCOMC__ ) hb_fsSetIOError( fsync( hFileHandle ) == 0, 0 );