about summary refs log tree commit diff stats
path: root/src/xmpp
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-10-18 21:40:11 +0100
committerJames Booth <boothj5@gmail.com>2014-10-18 21:41:39 +0100
commitbb3f1b09099bd0cfdcc3d8335e330a82a87af8ae (patch)
tree2a446aacb27f443ed5c2dd8777e3ff9f41345e34 /src/xmpp
parentc6ae459cd500e6e7bd8c845a407e1573e98a31cf (diff)
downloadprofani-tty-bb3f1b09099bd0cfdcc3d8335e330a82a87af8ae.tar.gz
Set file permissions for logs
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/capabilities.c6
1 files changed, 6 insertions, 0 deletions
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 <string.h>
 
 #include <glib.h>
+#include <glib/gstdio.h>
 #include <strophe.h>
 
 #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);
 }