diff options
author | click <none@none> | 2010-08-16 11:23:20 +0200 |
---|---|---|
committer | click <none@none> | 2010-08-16 11:23:20 +0200 |
commit | 29c2520506e12bbae669fbd190901443eca2f2a5 (patch) | |
tree | 9073ecd189c4d7ce3123469f655f3ffc61ba163f /externals/ace/Service_Gestalt.cpp | |
parent | b4bef54b7a6be1b25d670c3f630b1c4370da7757 (diff) |
Core/external : Reinstate ACE 5.8.1 (tested and building)
--HG--
branch : trunk
Diffstat (limited to 'externals/ace/Service_Gestalt.cpp')
-rw-r--r-- | externals/ace/Service_Gestalt.cpp | 95 |
1 files changed, 54 insertions, 41 deletions
diff --git a/externals/ace/Service_Gestalt.cpp b/externals/ace/Service_Gestalt.cpp index 8b3f8b8ed3c..47ea3d1e81b 100644 --- a/externals/ace/Service_Gestalt.cpp +++ b/externals/ace/Service_Gestalt.cpp @@ -1,4 +1,4 @@ -// $Id: Service_Gestalt.cpp 89501 2010-03-17 08:59:56Z vzykov $ +// $Id: Service_Gestalt.cpp 91158 2010-07-21 15:54:12Z mesnier_p $ #include "ace/Svc_Conf.h" #include "ace/Get_Opt.h" @@ -31,7 +31,7 @@ ACE_RCSID (ace, Service_Gestalt, - "$Id: Service_Gestalt.cpp 89501 2010-03-17 08:59:56Z vzykov $") + "$Id: Service_Gestalt.cpp 91158 2010-07-21 15:54:12Z mesnier_p $") ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -259,32 +259,6 @@ ACE_Service_Gestalt::init_i (void) if (init_svc_conf_file_queue () == -1) return -1; - if ( svc_conf_file_queue_->is_empty ()) - { - // Check if the default file exists before attempting to queue it - // for processing - FILE *fp = ACE_OS::fopen (ACE_DEFAULT_SVC_CONF, - ACE_TEXT ("r")); - bool skip_static_svcs = (fp == 0); - if (fp != 0) - ACE_OS::fclose (fp); - - if (!skip_static_svcs) { - // Load the default "svc.conf" entry here if there weren't - // overriding -f arguments in <parse_args>. - if (svc_conf_file_queue_->enqueue_tail - (ACE_TString (ACE_DEFAULT_SVC_CONF)) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("enqueuing ") - ACE_DEFAULT_SVC_CONF - ACE_TEXT(" file")), - -1); - } - } - } - return 0; } @@ -1086,19 +1060,62 @@ ACE_Service_Gestalt::open_i (const ACE_TCHAR program_name[], ACE_Log_Msg::disable_debug_messages (); } + if (!ignore_default_svc_conf_file) + { + bool add_default = true; + bool has_files = this->svc_conf_file_queue_ && + !this->svc_conf_file_queue_->is_empty (); + bool has_cmdline = this->svc_queue_ && !this->svc_queue_->is_empty (); + if (has_files || has_cmdline) + { + // check if default file is already listed + ACE_TString *sptr = 0; + ACE_TString default_svc_conf (ACE_DEFAULT_SVC_CONF); + + for (ACE_SVC_QUEUE_ITERATOR iter (*this->svc_conf_file_queue_); + iter.next (sptr) != 0 && add_default; + iter.advance ()) + { + add_default = (*sptr != default_svc_conf); + } + + if (add_default) + { + FILE *fp = ACE_OS::fopen (ACE_DEFAULT_SVC_CONF, ACE_TEXT ("r")); + if (fp != 0) + ACE_OS::fclose(fp); + else + add_default = false; + + } + } + + // Load the default "svc.conf" entry. here if there weren't + // overriding -f arguments in <parse_args>. + if (add_default && svc_conf_file_queue_->enqueue_head + (ACE_TString (ACE_DEFAULT_SVC_CONF)) == -1) + { + errno = ENOENT; + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("enqueuing ") + ACE_DEFAULT_SVC_CONF + ACE_TEXT(" file")), + -1); + } + } + // See if we need to load the static services. if (this->no_static_svcs_ == 0 && this->load_static_svcs () == -1) result = -1; else { - if (this->process_directives (ignore_default_svc_conf_file) == -1) - result = -1; - else + result = this->process_directives (); + if (result != -1 || errno == ENOENT) result = this->process_commandline_directives (); } - // Reset debugging back to the way it was when we came into // into <open_i>. { @@ -1230,17 +1247,16 @@ ACE_Service_Gestalt::parse_args_i (int argc, // Process service configuration directives from the files queued for // processing int -ACE_Service_Gestalt::process_directives (bool ignore_default_svc_conf_file) +ACE_Service_Gestalt::process_directives (bool ) { ACE_TRACE ("ACE_Service_Gestalt::process_directives"); - if (this->svc_conf_file_queue_ == 0 - || this->svc_conf_file_queue_->is_empty ()) - return 0; + || this->svc_conf_file_queue_->is_empty ()) + { + return 0; + } ACE_TString *sptr = 0; - ACE_TString default_svc_conf (ACE_DEFAULT_SVC_CONF); - int failed = 0; // Iterate through all the svc.conf files. @@ -1248,9 +1264,6 @@ ACE_Service_Gestalt::process_directives (bool ignore_default_svc_conf_file) iter.next (sptr) != 0; iter.advance ()) { - if (*sptr == default_svc_conf && ignore_default_svc_conf_file) - continue; - int result = this->process_file (sptr->fast_rep ()); if (result < 0) return result; |