Skip to content

Commit

Permalink
config: fix .ini file read-only check
Browse files Browse the repository at this point in the history
Needs to be tested for existence as well.

Follow-up to ef56fd1.

re #182

Closes #114
  • Loading branch information
bk138 committed Oct 22, 2023
1 parent 3b6731d commit 1242a92
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,8 @@ void write_keyfile(GromitData *data)
g_key_file_set_boolean (key_file, "General", "ShowIntroOnStartup", data->show_intro_on_startup);
g_key_file_set_double (key_file, "Drawing", "Opacity", data->opacity);

// Check file permissions, if read-only, bail out
if (access(filename, W_OK) != 0) {
// if file exists but is read-only, bail out
if (access(filename, F_OK) == 0 && access(filename, W_OK) != 0) {
g_warning ("Not overwriting read-only key file");
goto cleanup;
}
Expand Down

0 comments on commit 1242a92

Please sign in to comment.