Skip to content

Commit

Permalink
Merge pull request #1310 from vojtechtrefny/master_config-load-error
Browse files Browse the repository at this point in the history
Include error message when loading config file fails
  • Loading branch information
vojtechtrefny authored Aug 29, 2024
2 parents a1c4406 + d72d533 commit 55d1ff3
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/udisksconfigmanager.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ parse_config_file (UDisksConfigManager *manager,
gchar *module_i;
gchar **modules;
gchar **modules_tmp;
GError *l_error = NULL;

/* Get modules and means of loading */
conf_filename = g_build_filename (G_DIR_SEPARATOR_S,
Expand All @@ -163,7 +164,7 @@ parse_config_file (UDisksConfigManager *manager,
/* Load config */
config_file = g_key_file_new ();
g_key_file_set_list_separator (config_file, ',');
if (g_key_file_load_from_file (config_file, conf_filename, G_KEY_FILE_NONE, NULL))
if (g_key_file_load_from_file (config_file, conf_filename, G_KEY_FILE_NONE, &l_error))
{
if (out_modules != NULL)
{
Expand Down Expand Up @@ -225,7 +226,16 @@ parse_config_file (UDisksConfigManager *manager,
}
else
{
udisks_warning ("Can't load configuration file %s", conf_filename);
if (l_error != NULL)
{
udisks_warning ("Can't load configuration file %s: %s", conf_filename, l_error->message);
g_error_free (l_error);
}
else
{
udisks_warning ("Can't load configuration file %s", conf_filename);
}

}

g_key_file_free (config_file);
Expand Down

0 comments on commit 55d1ff3

Please sign in to comment.