Permalink
Browse files

Don't overwrite error when grub.cfg is not found

  • Loading branch information...
1 parent 2da71db commit fec261dec7ab3bd2661f1219ece38600158f3e8e David Mohr committed May 17, 2010
Showing with 12 additions and 2 deletions.
  1. +9 −1 src/gchd-direct.c
  2. +3 −1 src/gchd.c
View
@@ -72,8 +72,16 @@ get_default_entry (Gchd * gchd, GError **error)
env_filename = gchd_get_grub_file (gchd, "grubenv", error);
- if (env_filename == NULL)
+ if (env_filename == NULL) {
+ /* we did not find grubenv, so assume that no default is set */
+ if (*error)
+ {
+ g_error_free (*error);
+ *error = NULL;
+ }
+
return "";
+ }
g_print ("Operating on %s\n", env_filename);
View
@@ -134,6 +134,8 @@ gchd_get_grub_file_from_root (Gchd * gchd, const gchar * root, const gchar * fil
const gchar ** base;
gboolean r;
+ g_assert (error == NULL || *error == NULL);
+
for (base = grub_config_locations; *base != NULL; base++)
{
cfg = g_build_filename (root, *base, file, NULL);
@@ -254,7 +256,7 @@ gchd_get_grub_file (Gchd * gchd, const gchar * file, GError **error)
cfg = gchd_get_grub_file_from_root (gchd, "/", file, error);
#endif
- if (cfg == NULL)
+ if (cfg == NULL && error && *error == NULL)
{
/* We never found the directory */
g_set_error (error, GCHD_ERROR,

0 comments on commit fec261d

Please sign in to comment.