From 83bf46f4066e3d5e838a32357c201de9bd6ecdfd Mon Sep 17 00:00:00 2001 From: Nikolai Kondrashov Date: Wed, 12 Feb 2014 10:12:59 -0500 Subject: Update DEBUG* invocations to use new levels Use a script to update DEBUG* macro invocations, which use literal numbers for levels, to use bitmask macros instead: grep -rl --include '*.[hc]' DEBUG . | while read f; do mv "$f"{,.orig} perl -e 'use strict; use File::Slurp; my @map=qw" SSSDBG_FATAL_FAILURE SSSDBG_CRIT_FAILURE SSSDBG_OP_FAILURE SSSDBG_MINOR_FAILURE SSSDBG_CONF_SETTINGS SSSDBG_FUNC_DATA SSSDBG_TRACE_FUNC SSSDBG_TRACE_LIBS SSSDBG_TRACE_INTERNAL SSSDBG_TRACE_ALL "; my $text=read_file(\*STDIN); my $repl; $text=~s/ ^ ( .* \b (DEBUG|DEBUG_PAM_DATA|DEBUG_GR_MEM) \s* \(\s* )( [0-9] )( \s*, ) ( \s* ) ( .* ) $ / $repl = $1.$map[$3].$4.$5.$6, length($repl) <= 80 ? $repl : $1.$map[$3].$4."\n".(" " x length($1)).$6 /xmge; print $text; ' < "$f.orig" > "$f" rm "$f.orig" done Reviewed-by: Jakub Hrozek Reviewed-by: Stephen Gallagher Reviewed-by: Simo Sorce --- src/tools/sss_groupmod.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src/tools/sss_groupmod.c') diff --git a/src/tools/sss_groupmod.c b/src/tools/sss_groupmod.c index 5ee97dd5e..21d78278c 100644 --- a/src/tools/sss_groupmod.c +++ b/src/tools/sss_groupmod.c @@ -61,7 +61,8 @@ int main(int argc, const char **argv) ret = set_locale(); if (ret != EOK) { - DEBUG(1, "set_locale failed (%d): %s\n", ret, strerror(ret)); + DEBUG(SSSDBG_CRIT_FAILURE, + "set_locale failed (%d): %s\n", ret, strerror(ret)); ERROR("Error setting the locale\n"); ret = EXIT_FAILURE; goto fini; @@ -106,7 +107,8 @@ int main(int argc, const char **argv) ret = init_sss_tools(&tctx); if (ret != EOK) { - DEBUG(1, "init_sss_tools failed (%d): %s\n", ret, strerror(ret)); + DEBUG(SSSDBG_CRIT_FAILURE, + "init_sss_tools failed (%d): %s\n", ret, strerror(ret)); if (ret == ENOENT) { ERROR("Error initializing the tools - no local domain\n"); } else { @@ -137,7 +139,8 @@ int main(int argc, const char **argv) if (addgroups) { ret = parse_groups(tctx, addgroups, &tctx->octx->addgroups); if (ret != EOK) { - DEBUG(1, "Cannot parse groups to add the group to\n"); + DEBUG(SSSDBG_CRIT_FAILURE, + "Cannot parse groups to add the group to\n"); ERROR("Internal error while parsing parameters\n"); ret = EXIT_FAILURE; goto fini; @@ -145,7 +148,8 @@ int main(int argc, const char **argv) ret = parse_group_name_domain(tctx, tctx->octx->addgroups); if (ret != EOK) { - DEBUG(1, "Cannot parse FQDN groups to add the group to\n"); + DEBUG(SSSDBG_CRIT_FAILURE, + "Cannot parse FQDN groups to add the group to\n"); ERROR("Member groups must be in the same domain as parent group\n"); ret = EXIT_FAILURE; goto fini; @@ -164,7 +168,8 @@ int main(int argc, const char **argv) if (rmgroups) { ret = parse_groups(tctx, rmgroups, &tctx->octx->rmgroups); if (ret != EOK) { - DEBUG(1, "Cannot parse groups to remove the group from\n"); + DEBUG(SSSDBG_CRIT_FAILURE, + "Cannot parse groups to remove the group from\n"); ERROR("Internal error while parsing parameters\n"); ret = EXIT_FAILURE; goto fini; @@ -172,7 +177,8 @@ int main(int argc, const char **argv) ret = parse_group_name_domain(tctx, tctx->octx->rmgroups); if (ret != EOK) { - DEBUG(1, "Cannot parse FQDN groups to remove the group from\n"); + DEBUG(SSSDBG_CRIT_FAILURE, + "Cannot parse FQDN groups to remove the group from\n"); ERROR("Member groups must be in the same domain as parent group\n"); ret = EXIT_FAILURE; goto fini; @@ -244,7 +250,8 @@ done: } if (tctx->error) { ret = tctx->error; - DEBUG(1, "sysdb operation failed (%d)[%s]\n", ret, strerror(ret)); + DEBUG(SSSDBG_CRIT_FAILURE, + "sysdb operation failed (%d)[%s]\n", ret, strerror(ret)); switch (ret) { case ENOENT: ERROR("Could not modify group - check if member group names are correct\n"); -- cgit