This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU Mailutils".
http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=7bc05c7755523cdb1222463e5e3c9e71f6906f18 The branch, master has been updated via 7bc05c7755523cdb1222463e5e3c9e71f6906f18 (commit) from dd3598aa1d82c29132a24663781738fd321ceb8c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7bc05c7755523cdb1222463e5e3c9e71f6906f18 Author: Sergey Poznyakoff <g...@gnu.org> Date: Thu Dec 8 23:05:51 2016 +0200 Fix eventual dangling pointers Don't set mu_log_tag, leave that to the caller. * libmailutils/cli/cli.c (mu_cli_ext): Don't set mu_log_tag. * libmailutils/stdstream/strerr.c: Use MU_LOG_TAG macro from syslog.h * sieve/sieve.c: Redo --no-program-name support ----------------------------------------------------------------------- Summary of changes: libmailutils/cli/cli.c | 9 +-------- libmailutils/stdstream/strerr.c | 2 +- sieve/sieve.c | 24 ++++++++++++++++-------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/libmailutils/cli/cli.c b/libmailutils/cli/cli.c index 557a9a6..0381f9c 100644 --- a/libmailutils/cli/cli.c +++ b/libmailutils/cli/cli.c @@ -500,16 +500,9 @@ mu_cli_ext (int argc, char **argv, hints.flags &= ~MU_CFHINT_PER_USER_FILE; /* Set program name */ - if (hints.flags & MU_CFHINT_PROGRAM) - { - if (!mu_log_tag) - mu_log_tag = (char*)hints.program; - } - else + if (!(hints.flags & MU_CFHINT_PROGRAM)) { mu_set_program_name (argv[0]); - if (!mu_log_tag) - mu_log_tag = (char*)mu_program_name; hints.program = (char*) mu_program_name; hints.flags |= MU_CFHINT_PROGRAM; } diff --git a/libmailutils/stdstream/strerr.c b/libmailutils/stdstream/strerr.c index 52fa80e..6830041 100644 --- a/libmailutils/stdstream/strerr.c +++ b/libmailutils/stdstream/strerr.c @@ -117,7 +117,7 @@ mu_stdstream_strerr_setup (int type) if (mu_stdstream_strerr_create (&str, type, mu_log_facility, LOG_ERR, - mu_log_tag, NULL) == 0) + MU_LOG_TAG (), NULL) == 0) { if (mu_log_print_severity) { diff --git a/sieve/sieve.c b/sieve/sieve.c index 591a735..4831307 100644 --- a/sieve/sieve.c +++ b/sieve/sieve.c @@ -59,6 +59,7 @@ int dry_run; static int sieve_print_locus = 1; /* Should the log messages include the locus */ +static int no_program_name; static void modify_debug_flags (mu_debug_level_t set, mu_debug_level_t clr) @@ -124,13 +125,6 @@ cli_email (struct mu_parseopt *po, struct mu_option *opt, char const *arg) mu_parseopt_error (po, _("invalid email: %s"), mu_strerror (rc)); } -static void -cli_no_program_name (struct mu_parseopt *po, struct mu_option *opt, - char const *arg) -{ - mu_log_tag = NULL; -} - static struct mu_option sieve_options[] = { { "dry-run", 'n', NULL, MU_OPTION_DEFAULT, N_("do not execute any actions, just print what would be done"), @@ -168,7 +162,7 @@ static struct mu_option sieve_options[] = { mu_c_bool, &expression_option }, { "no-program-name", 0, NULL, MU_OPTION_DEFAULT, N_("do not prefix diagnostic messages with the program name"), - mu_c_string, NULL, cli_no_program_name }, + mu_c_int, &no_program_name }, MU_OPTION_END }, *options[] = { sieve_options, NULL }; @@ -414,6 +408,20 @@ main (int argc, char *argv[]) mu_cli (argc, argv, &cli, sieve_capa, NULL, &argc, &argv); if (dry_run) verbose++; + + if (no_program_name) + { + mu_stream_t errstr; + + mu_log_tag = NULL; + rc = mu_stdstream_strerr_create (&errstr, MU_STRERR_STDERR, 0, 0, + NULL, NULL); + if (rc == 0) + { + mu_stream_destroy (&mu_strerr); + mu_strerr = errstr; + } + } if (argc == 0) { hooks/post-receive -- GNU Mailutils _______________________________________________ Commit-mailutils mailing list Commit-mailutils@gnu.org https://lists.gnu.org/mailman/listinfo/commit-mailutils