mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Set file permissions for accounts file
This commit is contained in:
parent
b87c158c6a
commit
462cf67f1d
@ -36,6 +36,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
#include "accounts.h"
|
||||
|
||||
@ -80,6 +81,10 @@ _accounts_load(void)
|
||||
enabled_ac = autocomplete_new();
|
||||
accounts_loc = _get_accounts_file();
|
||||
|
||||
if (g_file_test(accounts_loc, G_FILE_TEST_EXISTS)) {
|
||||
g_chmod(accounts_loc, S_IRUSR | S_IWUSR);
|
||||
}
|
||||
|
||||
accounts = g_key_file_new();
|
||||
g_key_file_load_from_file(accounts, accounts_loc, G_KEY_FILE_KEEP_COMMENTS,
|
||||
NULL);
|
||||
@ -804,6 +809,7 @@ _save_accounts(void)
|
||||
gsize g_data_size;
|
||||
gchar *g_accounts_data = g_key_file_to_data(accounts, &g_data_size, NULL);
|
||||
g_file_set_contents(accounts_loc, g_accounts_data, g_data_size, NULL);
|
||||
g_chmod(accounts_loc, S_IRUSR | S_IWUSR);
|
||||
g_free(g_accounts_data);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user