From Microsoft documentation:
Currently, the generated name is used as-is and thus the effect is that it tries to create a file on the root of the current drive and since UAC won't allow a file to be created on c:\, it silently fails and crash not long after.Note than when a file name is pre-pended with a backslash and no path information, such as \fname21, this indicates that the name is valid for the current working directory.
A quick fix that first appear to me as compatible with other platforms would be to check if the filename starts with a backslash ('\\') and either prepend a dot ('.') or skip the backslash when assigning mTempFileName:
Code: Select all
if (tmpname[0] == '\\')
mTempFileName = &tmpname[1];
else
mTempFileName = tmpname;
From what I've read somewhere, tmpnam() would generate a complete valid temporary filename on linux, such as '/tmp/ta22.1'.
What do you think?
Edit: typos