mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Set file permissions for preferences file
This commit is contained in:
parent
462cf67f1d
commit
c6ae459cd5
@ -39,6 +39,8 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
#ifdef HAVE_NCURSESW_NCURSES_H
|
||||
#include <ncursesw/ncurses.h>
|
||||
#elif HAVE_NCURSES_H
|
||||
@ -80,6 +82,10 @@ prefs_load(void)
|
||||
log_info("Loading preferences");
|
||||
prefs_loc = _get_preferences_file();
|
||||
|
||||
if (g_file_test(prefs_loc, G_FILE_TEST_EXISTS)) {
|
||||
g_chmod(prefs_loc, S_IRUSR | S_IWUSR);
|
||||
}
|
||||
|
||||
prefs = g_key_file_new();
|
||||
g_key_file_load_from_file(prefs, prefs_loc, G_KEY_FILE_KEEP_COMMENTS,
|
||||
NULL);
|
||||
@ -401,6 +407,7 @@ _save_prefs(void)
|
||||
gsize g_data_size;
|
||||
gchar *g_prefs_data = g_key_file_to_data(prefs, &g_data_size, NULL);
|
||||
g_file_set_contents(prefs_loc, g_prefs_data, g_data_size, NULL);
|
||||
g_chmod(prefs_loc, S_IRUSR | S_IWUSR);
|
||||
g_free(g_prefs_data);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user