summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Application.cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2009-04-14 09:42:22 +1000
committerMichi Henning <michi@zeroc.com>2009-04-14 09:42:22 +1000
commit955dea1f9f2e3e3ebe3eb4a8266db383153d668d (patch)
tree41d6e580cc6f1a9b9fedf77c30dfea98c770300d /cpp/src/Ice/Application.cpp
parentbug 564 - Java resource leak (diff)
downloadice-955dea1f9f2e3e3ebe3eb4a8266db383153d668d.tar.bz2
ice-955dea1f9f2e3e3ebe3eb4a8266db383153d668d.tar.xz
ice-955dea1f9f2e3e3ebe3eb4a8266db383153d668d.zip
Bug 3963: Crash if argc == 0
Diffstat (limited to 'cpp/src/Ice/Application.cpp')
-rw-r--r--cpp/src/Ice/Application.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/cpp/src/Ice/Application.cpp b/cpp/src/Ice/Application.cpp
index 5a2a80805f0..0b1f40439e0 100644
--- a/cpp/src/Ice/Application.cpp
+++ b/cpp/src/Ice/Application.cpp
@@ -280,12 +280,20 @@ Ice::Application::main(int argc, char* argv[], const char* configFile)
}
catch(const std::exception& ex)
{
- cerr << argv[0] << ": " << ex.what() << endl;
+ if(argv[0])
+ {
+ cerr << argv[0] << ": ";
+ }
+ cerr << ex.what() << endl;
return EXIT_FAILURE;
}
catch(...)
{
- cerr << argv[0] << ": unknown exception" << endl;
+ if(argv[0])
+ {
+ cerr << argv[0] << ": ";
+ }
+ cerr << "unknown exception" << endl;
return EXIT_FAILURE;
}
}
@@ -297,7 +305,11 @@ Ice::Application::main(int argc, char* argv[], const InitializationData& initDat
{
if(_communicator != 0)
{
- cerr << argv[0] << ": only one instance of the Application class can be used" << endl;
+ if(argv[0])
+ {
+ cerr << argv[0] << ": ";
+ }
+ cerr << "only one instance of the Application class can be used" << endl;
return EXIT_FAILURE;
}
int status;
@@ -322,7 +334,11 @@ Ice::Application::main(int argc, char* argv[], const InitializationData& initDat
}
catch(const CtrlCHandlerException&)
{
- cerr << argv[0] << ": only one instance of the Application class can be used" << endl;
+ if(argv[0])
+ {
+ cerr << argv[0] << ": ";
+ }
+ cerr << "only one instance of the Application class can be used" << endl;
status = EXIT_FAILURE;
}
}
@@ -539,7 +555,7 @@ Ice::Application::mainInternal(int argc, char* argv[], const InitializationData&
}
_interrupted = false;
- _appName = argv[0];
+ _appName = argv[0] ? argv[0] : "";
//
// We parse the properties here to extract Ice.ProgramName.