From c6e95d22d77f480804ddb5c505891206b427dfb1 Mon Sep 17 00:00:00 2001 From: Phil Pennock Date: Mon, 7 May 2012 06:09:37 -0400 Subject: revert "%s" addition in em_main.c, broke %D in log_file. Also added gdb support. This leaves us with a printf warning. We accept that as the cost of using PRINTF_FORMAT for strings that aren't libc formats. --- src/OS/eximon.conf-Default | 2 +- src/exim_monitor/em_main.c | 4 +++- src/src/eximon.src | 17 +++++++++++++++-- 3 files changed, 19 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/OS/eximon.conf-Default b/src/OS/eximon.conf-Default index 9e0769831..2f874ef53 100644 --- a/src/OS/eximon.conf-Default +++ b/src/OS/eximon.conf-Default @@ -5,7 +5,7 @@ # The name of the eximon binary, usually the same as the eximon script, # with .bin stuck on the end. -EXIMON_BINARY=${EXIMON_BINARY-$0.bin} +EXIMON_BINARY="${EXIMON_BINARY-$0.bin}" # The remaining parameters are values likely to be changed to suit the # user's taste. They are documented in the EDITME file. diff --git a/src/exim_monitor/em_main.c b/src/exim_monitor/em_main.c index 7193640a5..a0b94b168 100644 --- a/src/exim_monitor/em_main.c +++ b/src/exim_monitor/em_main.c @@ -654,7 +654,9 @@ today.) */ if (log_file[0] != 0) { - (void)string_format(log_file_open, sizeof(log_file_open), "%s", CS log_file); + /* Do *not* use "%s" here, we need the %D datestamp in the log_file to + be expanded! */ + (void)string_format(log_file_open, sizeof(log_file_open), CS log_file); log_datestamping = string_datestamp_offset >= 0; LOG = fopen(CS log_file_open, "r"); diff --git a/src/src/eximon.src b/src/src/eximon.src index d8b3b3182..2211c58a6 100644 --- a/src/src/eximon.src +++ b/src/src/eximon.src @@ -19,6 +19,14 @@ # PROCESSED_FLAG +# See if caller wants to invoke gdb + +use_gdb='' + +case ${1:-foo} in + gdb*) use_gdb="$1"; shift ;; +esac + # Save arguments (can be the usual X parameters) cmd_args="$@" @@ -181,8 +189,13 @@ export EXIM_PATH LD_LIBRARY_PATH \ # Exec to the program we really want to run, thereby continuing in # just the one process, and let it run in parallel with whatever -# called this script. +# called this script (unless gdb was requested in original $1). -exec ${EXIMON_BINARY} $cmd_args & +if [ "${use_gdb:-}" = "" ] ; then + exec "${EXIMON_BINARY}" $cmd_args & +else + exec "$use_gdb" "${EXIMON_BINARY}" $cmd_args + # not backgrounded +fi # End -- cgit v1.2.3