@@ -309,8 +309,14 @@ void os_daemonize(void)
void os_setup_post(void)
{
+ static bool os_setup_post_done;
int fd = 0;
+ if (os_setup_post_done) {
+ return;
+ }
+ os_setup_post_done = true;
+
if (daemonize) {
if (chdir("/")) {
error_report("not able to chdir to /: %s", strerror(errno));
@@ -1960,6 +1960,7 @@ static void main_loop(void)
#ifdef CONFIG_PROFILER
ti = profile_getclock();
#endif
+ os_setup_post();
main_loop_wait(false);
#ifdef CONFIG_PROFILER
dev_time += profile_getclock() - ti;
@@ -4707,7 +4708,6 @@ int main(int argc, char **argv, char **envp)
}
accel_setup_post(current_machine);
- os_setup_post();
main_loop();