diff --git a/src/log.c b/src/log.c index fa1696e0..c525c3d9 100644 --- a/src/log.c +++ b/src/log.c @@ -40,6 +40,7 @@ #include #include "glib.h" +#include "glib/gstdio.h" #include "log.h" @@ -133,6 +134,7 @@ log_init(log_level_t filter) tz = g_time_zone_new_local(); gchar *log_file = _get_main_log_file(); logp = fopen(log_file, "a"); + g_chmod(log_file, S_IRUSR | S_IWUSR); mainlogfile = g_string_new(log_file); free(log_file); } @@ -274,6 +276,7 @@ chat_log_chat(const gchar * const login, gchar *other, date_fmt = g_date_time_format(dt, "%H:%M:%S"); FILE *logp = fopen(dated_log->filename, "a"); + g_chmod(dated_log->filename, S_IRUSR | S_IWUSR); if (logp != NULL) { if (direction == PROF_IN_LOG) { if (strncmp(msg, "/me ", 4) == 0) { @@ -322,6 +325,7 @@ groupchat_log_chat(const gchar * const login, const gchar * const room, gchar *date_fmt = g_date_time_format(dt, "%H:%M:%S"); FILE *logp = fopen(dated_log->filename, "a"); + g_chmod(dated_log->filename, S_IRUSR | S_IWUSR); if (logp != NULL) { if (strncmp(msg, "/me ", 4) == 0) { fprintf(logp, "%s - *%s %s\n", date_fmt, nick, msg + 4); diff --git a/src/xmpp/capabilities.c b/src/xmpp/capabilities.c index dc19e143..1d6907b8 100644 --- a/src/xmpp/capabilities.c +++ b/src/xmpp/capabilities.c @@ -42,6 +42,7 @@ #include #include +#include #include #include "common.h" @@ -69,6 +70,10 @@ caps_init(void) log_info("Loading capabilities cache"); cache_loc = _get_cache_file(); + if (g_file_test(cache_loc, G_FILE_TEST_EXISTS)) { + g_chmod(cache_loc, S_IRUSR | S_IWUSR); + } + cache = g_key_file_new(); g_key_file_load_from_file(cache, cache_loc, G_KEY_FILE_KEEP_COMMENTS, NULL); @@ -614,6 +619,7 @@ _save_cache(void) gsize g_data_size; gchar *g_cache_data = g_key_file_to_data(cache, &g_data_size, NULL); g_file_set_contents(cache_loc, g_cache_data, g_data_size, NULL); + g_chmod(cache_loc, S_IRUSR | S_IWUSR); g_free(g_cache_data); }