From e88ac13e5380a88f7f5ff7761a58ed419c3f409a Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Fri, 16 May 2008 14:32:42 +0000 Subject: [PATCH] Fixes trac:1290: ensure that we setup the orte_init subsystem before using it. This commit was SVN r18448. The following Trac tickets were found above: Ticket 1290 --> https://svn.open-mpi.org/trac/ompi/ticket/1290 --- orte/util/output.c | 44 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/orte/util/output.c b/orte/util/output.c index f78696a4cb..b962fbe2fc 100644 --- a/orte/util/output.c +++ b/orte/util/output.c @@ -764,7 +764,11 @@ void orte_output_finalize(void) { int i; orte_output_stream_t **streams; - + + if (!orte_output_ready) { + return; + } + orte_output_ready = false; OBJ_DESTRUCT(&orte_output_default); @@ -809,6 +813,13 @@ int orte_output_open(opal_output_stream_t *lds, const char *primary_tag, ...) va_list arglist; char *tag; + if (!orte_output_ready) { + int rc; + if (ORTE_SUCCESS != (rc = orte_output_init())) { + return rc; + } + } + /* if we are the HNP, this function just acts as * a wrapper around the corresponding opal_output fn */ @@ -870,8 +881,15 @@ track: void orte_output(int output_id, const char *format, ...) { - /* just call output_vverbose with a verbosity of 0 */ va_list arglist; + + if (!orte_output_ready) { + if (ORTE_SUCCESS != orte_output_init()) { + return; + } + } + + /* just call output_vverbose with a verbosity of 0 */ va_start(arglist, format); output_vverbose(0, output_id, ORTE_PROC_MY_NAME->jobid, ORTE_PROC_MY_NAME->vpid, format, arglist); va_end(arglist); @@ -879,8 +897,15 @@ void orte_output(int output_id, const char *format, ...) void orte_output_verbose(int verbose_level, int output_id, const char *format, ...) { - /* just call output_verbose with the specified verbosity */ va_list arglist; + + if (!orte_output_ready) { + if (ORTE_SUCCESS != orte_output_init()) { + return; + } + } + + /* just call output_verbose with the specified verbosity */ va_start(arglist, format); output_vverbose(verbose_level, output_id, ORTE_PROC_MY_NAME->jobid, ORTE_PROC_MY_NAME->vpid, format, arglist); va_end(arglist); @@ -890,6 +915,12 @@ void orte_output_close(int output_id) { orte_output_stream_t **streams; + if (!orte_output_ready) { + if (ORTE_SUCCESS != orte_output_init()) { + return; + } + } + /* cleanout the stream settings */ streams = (orte_output_stream_t**)orte_output_streams.addr; if (output_id >= 0 && NULL != streams[output_id]) { @@ -906,6 +937,13 @@ int orte_show_help(const char *filename, const char *topic, va_list arglist; char *output; + if (!orte_output_ready) { + int rc; + if (ORTE_SUCCESS != (rc = orte_output_init())) { + return rc; + } + } + va_start(arglist, want_error_header); output = opal_show_help_vstring(filename, topic, want_error_header, arglist);