From f9df3ffedafe4ee36a74949958527ecc0c23c841 Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Sat, 10 Sep 2011 20:17:57 +0200 Subject: sync the copied config files to disk before continuing otherwise a race condition might appear between copying the default config files to .fluxbox/ and executing 'fluxbox-update_configs'. under macosx this lead to 'fluxbox hangs'. --- src/main.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main.cc b/src/main.cc index 00fa51f..26070dc 100644 --- a/src/main.cc +++ b/src/main.cc @@ -52,6 +52,10 @@ #include #endif +#ifdef HAVE_UNISTD_H + #include +#endif + #ifdef HAVE_SYS_STAT_H #include #include @@ -365,13 +369,19 @@ void setupConfigFiles(const std::string& dirname, const std::string& rc) { } } + bool sync_fs = false; + // copy default files if needed for (size_t i = 0; i < nr_of_cfiles; ++i) { if (cfiles[i].create_file) { FbTk::FileUtil::copyFile(cfiles[i].default_name, cfiles[i].filename.c_str()); + sync_fs = true; } } + if (sync_fs) { + sync(); + } } @@ -408,6 +418,7 @@ void updateConfigFilesIfNeeded(const std::string& rc_file) { << commandargs << "' failed." << endl; } + sync(); } } -- cgit v0.11.2