From 28f0fed0aa1d339d60228969b0e6b174da27e42c Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Mon, 8 Oct 2012 16:22:35 +0400 Subject: [PATCH] Redo the way binpatch backs up, so as not to lose the executable perms. --- library/binpatch.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/library/binpatch.cpp b/library/binpatch.cpp index 10188db8c..88ef2f004 100644 --- a/library/binpatch.cpp +++ b/library/binpatch.cpp @@ -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;