From cbceb9fb41067d4bfcb6c9d9b8559bea598dc67a Mon Sep 17 00:00:00 2001 From: Jaime Thomas Date: Mon, 7 Apr 2008 20:40:30 +0000 Subject: [PATCH] Clean up exiting --- ecdb/trunk/src/ecdb.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/ecdb/trunk/src/ecdb.c b/ecdb/trunk/src/ecdb.c index 2a564a9..6181afc 100644 --- a/ecdb/trunk/src/ecdb.c +++ b/ecdb/trunk/src/ecdb.c @@ -13,6 +13,7 @@ main(int argc, char **argv) { Ecdb_Project *proj; int i; + int ret = 0; if (!ecore_init()) { @@ -23,13 +24,15 @@ main(int argc, char **argv) if (!ecore_file_init()) { printf("Cannot initialize Ecore_File!\n"); - return 1; + ret = 1; + goto SHUTDOWN; } if (!ecdb_setup()) { printf("Setup failed\n"); - return 1; + ret = 1; + goto SHUTDOWN; } ecdb_print_drive_info(); @@ -47,24 +50,32 @@ main(int argc, char **argv) proj->publisher_id = proj->data_preparer_id = proj->system_id = proj->application_id = proj->copywrite_id = proj->abstract_id = proj->biblio_id = "ecdb"; - ecdb_aquire_drive(proj, 0); + + if (ecdb_aquire_drive(proj, 0)) + { + printf("Couldn't grab drive!\n"); + ret = 1; + goto SHUTDOWN; + } if (ecdb_burn_project(proj)) { printf("Burn was unsuccessful\n"); - burn_finish(); - ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, NULL, NULL, NULL); - return 1; + ret = 1; + goto SHUTDOWN; } ecore_main_loop_begin(); /* End testing */ + +SHUTDOWN: burn_finish(); ecore_shutdown(); ecore_file_shutdown(); + ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, NULL, NULL, NULL); printf("Program Done\n"); - return 0; + return ret; }; int