summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Untz <vuntz@gnome.org>2007-09-01 14:25:55 +0000
committerVincent Untz <vuntz@gnome.org>2007-09-01 14:25:55 +0000
commitc7d783c84eec8d07049ab01988e4da43559ce80f (patch)
treecc60a7da5056d8ce89f930d868f8aa1d8e55baaa
parent740682d75b9ea0cb2934b26f4730c0171f497cb6 (diff)
Don't exit(), but let the main() function do it with a proper error
2007-09-01 Vincent Untz <vuntz@gnome.org> Don't exit(), but let the main() function do it with a proper error message. * src/install.c: (files_are_the_same): it's useless to exit() here if we can't stat() the files. Just continue the operations without removing the original file, that's the best option. (process_one_file): don't exit(), but set the GError
-rw-r--r--ChangeLog10
-rw-r--r--src/install.c13
2 files changed, 18 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 4e1e746..fa3fb65 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2007-09-01 Vincent Untz <vuntz@gnome.org>
+ Don't exit(), but let the main() function do it with a proper error
+ message.
+
+ * src/install.c: (files_are_the_same): it's useless to exit() here if
+ we can't stat() the files. Just continue the operations without
+ removing the original file, that's the best option.
+ (process_one_file): don't exit(), but set the GError
+
+2007-09-01 Vincent Untz <vuntz@gnome.org>
+
* configure.in: require glib 2.8.0
* src/install.c: (mkdir_and_parents): kill
(main): directly use g_mkdir_with_parents()
diff --git a/src/install.c b/src/install.c
index b1a891d..dc93836 100644
--- a/src/install.c
+++ b/src/install.c
@@ -46,13 +46,13 @@ files_are_the_same (const char *first,
if (stat (first, &first_sb) < 0)
{
g_printerr (_("Could not stat \"%s\": %s\n"), first, g_strerror (errno));
- exit (1);
+ return TRUE;
}
if (stat (second, &second_sb) < 0)
{
g_printerr (_("Could not stat \"%s\": %s\n"), first, g_strerror (errno));
- exit (1);
+ return TRUE;
}
return ((first_sb.st_dev == second_sb.st_dev) &&
@@ -107,7 +107,9 @@ process_one_file (const char *filename,
if (!desktop_file_fixup (kf, filename)) {
g_key_file_free (kf);
- exit (1);
+ g_set_error (err, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_PARSE,
+ _("Failed to fix the content of the desktop file"));
+ return;
}
if (copy_name_to_generic_name)
@@ -212,9 +214,10 @@ process_one_file (const char *filename,
/* Load and validate the file we just wrote */
if (!desktop_file_validate (new_filename, FALSE, TRUE))
{
- g_printerr (_("desktop-file-install created an invalid desktop file!\n"));
g_free (new_filename);
- exit (1);
+ g_set_error (err, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_PARSE,
+ _("Failed to validate the created desktop file"));
+ return;
}
if (rebuild_mime_info_cache)