Redo the way binpatch backs up, so as not to lose the executable perms.

develop
Alexander Gavrilov 2012-10-08 16:22:35 +04:00
parent 408f0cb06e
commit 28f0fed0aa
1 changed files with 1 additions and 4 deletions

@ -291,10 +291,7 @@ int main (int argc, char *argv[])
patch.apply(bindata.data(), bindata.size(), false);
}
std::string bak_file = exe_file + ".bak";
remove(bak_file.c_str());
if (rename(exe_file.c_str(), bak_file.c_str()) != 0)
if (!save_file(bindata, exe_file + ".bak"))
{
cerr << "Could not create backup." << endl;
return 1;