summaryrefslogtreecommitdiff
path: root/cpp/src/slice2rb/Main.cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2008-11-18 13:39:14 -0330
committerDwayne Boone <dwayne@zeroc.com>2008-11-18 13:39:14 -0330
commitac8bf31698d259127646a4e114deca1e7d5e334c (patch)
treef694a8fc9e17bbb0044082510e5d0dd5622cbedc /cpp/src/slice2rb/Main.cpp
parentRemoved debug statements (diff)
downloadice-ac8bf31698d259127646a4e114deca1e7d5e334c.tar.bz2
ice-ac8bf31698d259127646a4e114deca1e7d5e334c.tar.xz
ice-ac8bf31698d259127646a4e114deca1e7d5e334c.zip
Bug 3541 - Slice signal handling unsafe
Diffstat (limited to 'cpp/src/slice2rb/Main.cpp')
-rw-r--r--cpp/src/slice2rb/Main.cpp26
1 files changed, 7 insertions, 19 deletions
diff --git a/cpp/src/slice2rb/Main.cpp b/cpp/src/slice2rb/Main.cpp
index da01726693a..2e91d3c1d8a 100644
--- a/cpp/src/slice2rb/Main.cpp
+++ b/cpp/src/slice2rb/Main.cpp
@@ -30,16 +30,6 @@ using namespace std;
using namespace Slice;
using namespace Slice::Ruby;
-//
-// Callback for Crtl-C signal handling
-//
-static IceUtilInternal::Output _out;
-
-static void closeCallback()
-{
- _out.close();
-}
-
void
usage(const char* n)
{
@@ -204,26 +194,24 @@ main(int argc, char* argv[])
}
SignalHandler::addFile(file);
- SignalHandler::setCallback(closeCallback);
-
- _out.open(file.c_str());
- if(!_out)
+ IceUtilInternal::Output out;
+ out.open(file.c_str());
+ if(!out)
{
cerr << argv[0] << ": can't open `" << file << "' for writing" << endl;
u->destroy();
return EXIT_FAILURE;
}
- printHeader(_out);
- _out << "\n# Generated from file `" << base << ".ice'\n";
+ printHeader(out);
+ out << "\n# Generated from file `" << base << ".ice'\n";
//
// Generate the Ruby mapping.
//
- generate(u, all, checksum, includePaths, _out);
+ generate(u, all, checksum, includePaths, out);
- _out.close();
- SignalHandler::setCallback(0);
+ out.close();
}
u->destroy();