X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fdebug.c;h=42644868ca78619416f678c257c8ea05458aa85a;hb=9a4ce94579bc7161d4ed55b20f00b3f76deff3e2;hp=b44163263f9a98a3e551bff1d49ca27e85c8777c;hpb=a21840cbb7912c25abc1943c08d6980da7537a6c;p=chaz%2Fopenbox diff --git a/openbox/debug.c b/openbox/debug.c index b4416326..42644868 100644 --- a/openbox/debug.c +++ b/openbox/debug.c @@ -26,6 +26,10 @@ #include #include +#ifdef HAVE_UNISTD_H +# include +#endif + static gboolean enabled_types[OB_DEBUG_TYPE_NUM] = {FALSE}; static FILE *log_file = NULL; static guint rr_handler_id = 0; @@ -48,6 +52,8 @@ void ob_debug_startup(void) else { gchar *name = g_build_filename(obt_paths_cache_home(p), "openbox", "openbox.log", NULL); + /* unlink it before opening to remove competition */ + unlink(name); log_file = fopen(name, "w"); g_free(name); } @@ -62,6 +68,7 @@ void ob_debug_startup(void) g_log_set_handler("Openbox", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, log_handler, NULL); + obt_paths_unref(p); g_free(dir); }