13
0

close file before unlink

This commit is contained in:
Robin Gareus 2015-08-03 23:05:33 +02:00
parent 2443fd1d79
commit 847afa3f64
2 changed files with 13 additions and 5 deletions

View File

@ -98,10 +98,14 @@ static void au_unblacklist (std::string id)
} }
std::string bl; std::string bl;
std::ifstream ifs(fn.c_str()); {
bl.assign ((std::istreambuf_iterator<char>(ifs)), (std::istreambuf_iterator<char>())); std::ifstream ifs(fn.c_str());
::g_unlink(fn.c_str()); bl.assign ((std::istreambuf_iterator<char>(ifs)), (std::istreambuf_iterator<char>()));
}
::g_unlink (fn.c_str());
assert (!Glib::file_test (fn, Glib::FILE_TEST_EXISTS));
assert(id.find("\n") == string::npos); assert(id.find("\n") == string::npos);
id += "\n"; // add separator id += "\n"; // add separator

View File

@ -133,10 +133,14 @@ static void vstfx_un_blacklist (const char *idcs)
} }
std::string bl; std::string bl;
std::ifstream ifs (fn.c_str ()); {
bl.assign ((std::istreambuf_iterator<char> (ifs)), (std::istreambuf_iterator<char> ())); std::ifstream ifs (fn.c_str ());
bl.assign ((std::istreambuf_iterator<char> (ifs)), (std::istreambuf_iterator<char> ()));
}
::g_unlink (fn.c_str ()); ::g_unlink (fn.c_str ());
assert (!Glib::file_test (fn, Glib::FILE_TEST_EXISTS));
assert (id.find ("\n") == string::npos); assert (id.find ("\n") == string::npos);
id += "\n"; // add separator id += "\n"; // add separator