From f864276f35189bc7b4b7bc3c13852730c4c54f62 Mon Sep 17 00:00:00 2001 From: Noel Burton-Krahn Date: Tue, 13 Dec 2016 16:55:30 -0800 Subject: [PATCH] add error_exit_val argument to exit nonzero if there are processing errors --- src/cmd_parser.c | 2 ++ src/cmd_parser.h | 1 + src/createrepo_c.c | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cmd_parser.c b/src/cmd_parser.c index 866b7f6..7367bc7 100644 --- a/src/cmd_parser.c +++ b/src/cmd_parser.c @@ -186,6 +186,8 @@ static GOptionEntry cmd_entries[] = "Append this prefix before location_href in output repodata", "PREFIX" }, { "repomd-checksum", 0, 0, G_OPTION_ARG_STRING, &(_cmd_options.repomd_checksum), "Checksum type to be used in repomd.xml", "CHECKSUM_TYPE"}, + { "error-exit-val", 0, 0, G_OPTION_ARG_NONE, &(_cmd_options.error_exit_val), + "Exit with retval 2 if there were any errors during processing", NULL }, { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }, }; diff --git a/src/cmd_parser.h b/src/cmd_parser.h index 40051e7..64c7c0d 100644 --- a/src/cmd_parser.h +++ b/src/cmd_parser.h @@ -105,6 +105,7 @@ struct CmdOptions { gchar *location_prefix; /*!< Append this prefix into location_href during repodata generation. */ gchar *repomd_checksum; /*!< Checksum type for entries in repomd.xml */ + gboolean error_exit_val; /*!< exit 2 on processing errors */ /* Items filled by check_arguments() */ diff --git a/src/createrepo_c.c b/src/createrepo_c.c index 965cfc2..e16ae34 100644 --- a/src/createrepo_c.c +++ b/src/createrepo_c.c @@ -864,8 +864,8 @@ main(int argc, char **argv) g_thread_pool_free(pool, FALSE, TRUE); // if there were any errors, exit nonzero - if( user_data.had_errors ) { - exit_val = EXIT_FAILURE; + if( cmd_options->error_exit_val && user_data.had_errors ) { + exit_val = 2; } g_message("Pool finished%s", (user_data.had_errors ? " with errors" : "")); -- 2.7.4