struct CmdOptions *cmd_options;
gboolean ret;
GError *tmp_err = NULL;
-
+ int exit_val = EXIT_SUCCESS;
// Arguments parsing
cmd_options = parse_arguments(&argc, &argv, &tmp_err);
user_data.deltatargetpackages = NULL;
user_data.cut_dirs = cmd_options->cut_dirs;
user_data.location_prefix = cmd_options->location_prefix;
+ user_data.had_errors = 0;
g_debug("Thread pool user data ready");
// Wait until pool is finished
g_thread_pool_free(pool, FALSE, TRUE);
- g_message("Pool finished");
+
+ // if there were any errors, exit nonzero
+ if( user_data.had_errors ) {
+ exit_val = EXIT_FAILURE;
+ }
+
+ g_message("Pool finished%s", (user_data.had_errors ? " with errors" : ""));
cr_xml_dump_cleanup();
cr_package_parser_cleanup();
g_debug("All done");
- exit(EXIT_SUCCESS);
+ exit(exit_val);
}
if (tmp_err) {
g_critical("Cannot add primary chunk:\n%s\nError: %s",
res.primary, tmp_err->message);
+ udata->had_errors = TRUE;
g_clear_error(&tmp_err);
}
if (tmp_err) {
g_critical("Cannot add record of %s (%s) to primary db: %s",
pkg->name, pkg->pkgId, tmp_err->message);
+ udata->had_errors = TRUE;
g_clear_error(&tmp_err);
}
}
if (tmp_err) {
g_critical("Cannot add filelists chunk:\n%s\nError: %s",
res.filelists, tmp_err->message);
+ udata->had_errors = TRUE;
g_clear_error(&tmp_err);
}
if (tmp_err) {
g_critical("Cannot add record of %s (%s) to filelists db: %s",
pkg->name, pkg->pkgId, tmp_err->message);
+ udata->had_errors = TRUE;
g_clear_error(&tmp_err);
}
}
if (tmp_err) {
g_critical("Cannot add other chunk:\n%s\nError: %s",
res.other, tmp_err->message);
+ udata->had_errors = TRUE;
g_clear_error(&tmp_err);
}
if (tmp_err) {
g_critical("Cannot add record of %s (%s) to other db: %s",
pkg->name, pkg->pkgId, tmp_err->message);
+ udata->had_errors = TRUE;
g_clear_error(&tmp_err);
}
}
if (!pkg) {
g_warning("Cannot read package: %s: %s",
task->full_path, tmp_err->message);
+ udata->had_errors = TRUE;
g_clear_error(&tmp_err);
goto task_cleanup;
}
if (tmp_err) {
g_critical("Cannot dump XML for %s (%s): %s",
pkg->name, pkg->pkgId, tmp_err->message);
+ udata->had_errors = TRUE;
g_clear_error(&tmp_err);
goto task_cleanup;
}
if (tmp_err) {
g_critical("Cannot dump XML for %s (%s): %s",
md->name, md->pkgId, tmp_err->message);
+ udata->had_errors = TRUE;
g_clear_error(&tmp_err);
goto task_cleanup;
}
return;
}
-
-