1
1

Fix problem identified by Ferris McCormick -- we were missing some

out-of-bounds protection for output ID's in some functions.  Also,
move some logic for closing the syslog inside a conditional block --
it's only necessary to close the syslog if we actually closed a
stream.

This commit was SVN r7518.
Этот коммит содержится в:
Jeff Squyres 2005-09-27 16:43:48 +00:00
родитель 7c924dc221
Коммит 31b2ec198b

Просмотреть файл

@ -251,14 +251,13 @@ void opal_output_close(int output_id)
/* If it's valid, used, enabled, and has an open file descriptor,
* free the resources associated with the descriptor */
OPAL_THREAD_LOCK(&mutex);
if (output_id >= 0 && output_id < OPAL_OUTPUT_MAX_STREAMS &&
info[output_id].ldi_used && info[output_id].ldi_enabled) {
free_descriptor(output_id);
}
/* If no one has the syslog open, we should close it */
OPAL_THREAD_LOCK(&mutex);
for (i = 0; i < OPAL_OUTPUT_MAX_STREAMS; ++i) {
if (info[i].ldi_used && info[i].ldi_syslog) {
break;
@ -272,6 +271,7 @@ void opal_output_close(int output_id)
#else
DeregisterEventSource(info[output_id].ldi_syslog_ident);
#endif
}
/* Somewhat of a hack to free up the temp_str */
@ -290,11 +290,13 @@ void opal_output_close(int output_id)
*/
void opal_output(int output_id, const char *format, ...)
{
if (output_id >= 0 && output_id < OPAL_OUTPUT_MAX_STREAMS) {
va_list arglist;
va_start(arglist, format);
output(output_id, format, arglist);
va_end(arglist);
}
}
/*
@ -302,7 +304,8 @@ void opal_output(int output_id, const char *format, ...)
*/
void opal_output_verbose(int level, int output_id, const char *format, ...)
{
if (info[output_id].ldi_verbose_level >= level) {
if (output_id >= 0 && output_id < OPAL_OUTPUT_MAX_STREAMS &&
info[output_id].ldi_verbose_level >= level) {
va_list arglist;
va_start(arglist, format);
output(output_id, format, arglist);
@ -316,8 +319,10 @@ void opal_output_verbose(int level, int output_id, const char *format, ...)
*/
void opal_output_set_verbosity(int output_id, int level)
{
if (output_id >= 0 && output_id < OPAL_OUTPUT_MAX_STREAMS) {
info[output_id].ldi_verbose_level = level;
}
}
/*