downloadsmenu.cpp: Extract asset on data directory

Otherwise, GfLocalDir and GfDataDir might be residing on different file
systems, and therefore rename(3) could fail with EXDEV ("Invalid
cross-device link").


git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9503 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 7ffb92a15b0e36930c930f279d75e940d8083527
Former-commit-id: e0947c2dba73073af5b1be4b60469474b9fd6dea
This commit is contained in:
xavi92 2024-07-24 16:22:20 +00:00
parent 0cc87184ea
commit e785f426d2

View file

@ -581,17 +581,16 @@ int DownloadsMenu::extract(const entry *e, const std::string &src,
return -1;
}
std::string tmp;
std::string name;
if (tmppath(tmp))
if (randname(name))
{
error = "Failed to generate temporary filename";
GfLogError("tmppath failed\n");
error = "Failed to generate random directory name";
GfLogError("randname failed\n");
return -1;
}
tmp += "/";
std::string tmp = data + name + "/";
unzip u(src, tmp, a.directory);
std::string dst = data + a.path() + a.directory,
tmpd = tmp + a.directory;