Skip to content

Commit

Permalink
application: Use string::compare instead of find
Browse files Browse the repository at this point in the history
  • Loading branch information
ahodesuka committed Apr 12, 2021
1 parent 3b1f7bd commit 0e63a48
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,10 @@ void Application::on_shutdown()

for (auto&& i : Glib::Dir(Glib::get_tmp_dir()))
{
std::string filename{ "gdbus-nonce-file-" };
// 6 = random characters
if (i.find("gdbus-nonce-file-") != std::string::npos &&
i.length() == strlen("gdbus-nonce-file-") + 6)
if (i.compare(0, filename.length(), filename) == 0 &&
i.length() == filename.length() + 6)
g_unlink(Glib::build_filename(tmp_dir, i).c_str());
}
#endif // _WIN32
Expand Down

0 comments on commit 0e63a48

Please sign in to comment.