View Issue Details

IDProjectCategoryView StatusLast Update
0038772FPCRTLpublic2021-05-01 10:59
Reporterpiula3 Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.2.0 
Fixed in Version3.3.1 
Summary0038772: GetTempFileName fails if directory with suggested name exists
DescriptionGetTempFileName only checks for FileExists. When a directory with the same name, e.g. 'TMP00000.tmp' exists, this file name is returned, but it cannot be used.
Steps To Reproduce1. Create directory '%TEMP%\TMP00000.tmp'
2. Call GetTempFileName

It returns '%TEMP%\TMP00000.tmp', but it should be '%TEMP%\TMP00001.tmp'
Additional InformationOS is Windows 8.1 64 bit edition.

To fix, apply this change to file rtl\objpas\sysutils\osutil.inc:

approx. in line 248:

change

> Until not FileExists(Result);

to

> Until not FileExists(Result) and not DirectoryExists(Result);
TagsNo tags attached.
Fixed in Revision49225
FPCOldBugId
FPCTarget3.2.2
Attached Files

Activities

Michael Van Canneyt

2021-04-18 12:46

administrator   ~0130439

Applied as suggested, thanks for reporting !

Issue History

Date Modified Username Field Change
2021-04-18 12:39 piula3 New Issue
2021-04-18 12:46 Michael Van Canneyt Assigned To => Michael Van Canneyt
2021-04-18 12:46 Michael Van Canneyt Status new => resolved
2021-04-18 12:46 Michael Van Canneyt Resolution open => fixed
2021-04-18 12:46 Michael Van Canneyt Fixed in Version => 3.3.1
2021-04-18 12:46 Michael Van Canneyt Fixed in Revision => 49225
2021-04-18 12:46 Michael Van Canneyt FPCTarget => 4.0.0
2021-04-18 12:46 Michael Van Canneyt Note Added: 0130439
2021-05-01 10:59 Michael Van Canneyt FPCTarget 4.0.0 => 3.2.2