[Bug 4335] New: _tempnam does not check for the environment
variable TMP
Wine Bugs
wine-bugs at winehq.org
Tue Jan 17 20:27:11 CST 2006
http://bugs.winehq.org/show_bug.cgi?id=4335
Summary: _tempnam does not check for the environment variable TMP
Product: Wine
Version: 0.9.5.
Platform: Other
OS/Version: All
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: wine-files
AssignedTo: wine-bugs at winehq.org
ReportedBy: sascha93101 at yahoo.com
_tempnam should follow the rules described here:
http://msdn2.microsoft.com/en-us/library/hs3e7355.aspx
When the Microsoft linker links an executable using a resource file, it calls
_tempnam to get a name for a temporary files. Since TMP is ignored, the linker
gets back the name "/lnk**.tmp". In most cases, the user running linker doesn't
and shouldn't have write permissions in the root directory, and the linker
fails.
The fixed code is here:
char *_tempnam(const char *dir, const char *prefix)
{
char tmpbuf[MAX_PATH];
char save_TMP[MAX_PATH];
const char *tmp_dir = dir;
if (GetEnvironmentVariableA("TMP",save_TMP,sizeof(save_TMP)))
{
tmp_dir = save_TMP;
}
TRACE("dir (%s) prefix (%s)\n",tmp_dir,prefix);
if (GetTempFileNameA(tmp_dir,prefix,0,tmpbuf))
{
TRACE("got name (%s)\n",tmpbuf);
DeleteFileA(tmpbuf);
return _strdup(tmpbuf);
}
TRACE("failed (%ld)\n",GetLastError());
return NULL;
}
I'll send it to wine-patches at winehq.org too.
Also, http://bugs.winehq.org/show_bug.cgi?id=1652 could be another
manifestation of this bug.
--
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the wine-bugs
mailing list