summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjtc <jtc@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2005-03-02 14:26:37 +0000
committerjtc <jtc@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2005-03-02 14:26:37 +0000
commit48b9cc3823940e55a18f2b202e291f3af41a1d4f (patch)
tree5dcf813db4c453d785e08101d05a137c66cb17f8
parent5d9eeb46fbae6b09c929f8bc4eaacf23d381a1cf (diff)
downloadATCD-48b9cc3823940e55a18f2b202e291f3af41a1d4f.tar.gz
ChangeLogTag: Wed Mar 2 06:22:37 2005 J.T. Conklin <jtc@acorntoolworks.com>
-rw-r--r--TAO/ChangeLog10
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Naming_Server.cpp36
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Naming_Server.h2
3 files changed, 31 insertions, 17 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 050128e8811..47e7ae72b30 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,13 @@
+Wed Mar 2 06:22:37 2005 J.T. Conklin <jtc@acorntoolworks.com>
+
+ * orbsvcs/orbsvcs/Naming/Naming_Server.cpp:
+ * orbsvcs/orbsvcs/Naming/Naming_Server.h:
+
+ Changed to save the IOR file name instead of opening the IOR
+ file when parsing command line arguments. This avoids a file
+ descriptor leak if multiple "-o" options are specified on the
+ command line.
+
Wed Mar 2 12:33:12 UTC 2005 Johnny Willemsen <jwillemsen@remedy.nl>
* examples/POA/DSI/client.cpp:
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Naming_Server.cpp b/TAO/orbsvcs/orbsvcs/Naming/Naming_Server.cpp
index bb14c571b2b..42739dfd8e5 100644
--- a/TAO/orbsvcs/orbsvcs/Naming/Naming_Server.cpp
+++ b/TAO/orbsvcs/orbsvcs/Naming/Naming_Server.cpp
@@ -29,7 +29,7 @@ TAO_Naming_Server::TAO_Naming_Server (void)
ior_multicast_ (0),
naming_service_ior_ (),
context_index_ (0),
- ior_output_file_ (0),
+ ior_file_name_ (0),
pid_file_name_ (0),
context_size_ (ACE_DEFAULT_MAP_SIZE),
persistence_file_name_ (0),
@@ -59,7 +59,7 @@ TAO_Naming_Server::TAO_Naming_Server (CORBA::ORB_ptr orb,
ior_multicast_ (0),
naming_service_ior_ (),
context_index_ (0),
- ior_output_file_ (0),
+ ior_file_name_ (0),
pid_file_name_ (0),
context_size_ (ACE_DEFAULT_MAP_SIZE),
persistence_file_name_ (0),
@@ -190,13 +190,7 @@ TAO_Naming_Server::parse_args (int argc,
TAO_debug_level++;
break;
case 'o': // outputs the naming service ior to a file.
- this->ior_output_file_ =
- ACE_OS::fopen (get_opts.opt_arg (), ACE_LIB_TEXT("w"));
-
- if (this->ior_output_file_ == 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_LIB_TEXT("Unable to open %s for writing:(%u) %p\n"),
- get_opts.opt_arg(), errno, ACE_LIB_TEXT("TAO_Naming_Server::parse_args()")), -1);
+ this->ior_file_name_ = get_opts.opt_arg ();
break;
case 'p':
this->pid_file_name_ = get_opts.opt_arg ();
@@ -400,14 +394,23 @@ TAO_Naming_Server::init_with_orb (int argc,
ACE_ENDTRY;
ACE_CHECK_RETURN (-1);
- if (this->ior_output_file_ != 0)
+ if (this->ior_file_name_ != 0)
{
- CORBA::String_var str =
- this->naming_service_ior ();
- ACE_OS::fprintf (this->ior_output_file_,
- "%s",
- str.in ());
- ACE_OS::fclose (this->ior_output_file_);
+ FILE *iorf = ACE_OS::fopen (this->ior_file_name_, ACE_LIB_TEXT("w"));
+ if (iorf == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_LIB_TEXT("Unable to open %s for writing:(%u) %p\n"),
+ this->ior_file_name_,
+ errno,
+ ACE_LIB_TEXT("TAO_Naming_Server::init_with_orb")),
+ -1);
+ }
+
+ CORBA::String_var str = this->naming_service_ior ();
+
+ ACE_OS::fprintf (iorf, "%s\n", str.in ());
+ ACE_OS::fclose (iorf);
}
if (this->pid_file_name_ != 0)
@@ -421,6 +424,7 @@ TAO_Naming_Server::init_with_orb (int argc,
ACE_OS::fclose (pidf);
}
}
+
return 0;
}
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Naming_Server.h b/TAO/orbsvcs/orbsvcs/Naming/Naming_Server.h
index 5305864a809..185773b357d 100644
--- a/TAO/orbsvcs/orbsvcs/Naming/Naming_Server.h
+++ b/TAO/orbsvcs/orbsvcs/Naming/Naming_Server.h
@@ -183,7 +183,7 @@ protected:
PortableServer::POA_var ns_poa_;
/// File to output the Naming Service IOR.
- FILE *ior_output_file_;
+ const ACE_TCHAR *ior_file_name_;
/// File to output the process id.
const ACE_TCHAR *pid_file_name_;