summaryrefslogtreecommitdiff
path: root/cpp/src/IcePack/ActivatorI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/IcePack/ActivatorI.cpp')
-rw-r--r--cpp/src/IcePack/ActivatorI.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/cpp/src/IcePack/ActivatorI.cpp b/cpp/src/IcePack/ActivatorI.cpp
index 7628fb8fa7c..3a6fabe53b9 100644
--- a/cpp/src/IcePack/ActivatorI.cpp
+++ b/cpp/src/IcePack/ActivatorI.cpp
@@ -287,12 +287,20 @@ IcePack::ActivatorI::activate(const ServerPtr& server)
void
IcePack::ActivatorI::deactivate(const ServerPtr& server)
{
- pid_t pid = static_cast<pid_t>(server->getPid());
-
+ Ice::Int pid = server->getPid();
+
+ if(pid == 0)
+ {
+ //
+ // Server is already deactivated.
+ //
+ return;
+ }
+
//
// Send a SIGTERM to the process.
//
- if(::kill(pid, SIGTERM))
+ if(::kill(static_cast<pid_t>(pid), SIGTERM))
{
SyscallException ex(__FILE__, __LINE__);
ex.error = getSystemErrno();
@@ -309,12 +317,20 @@ IcePack::ActivatorI::deactivate(const ServerPtr& server)
void
IcePack::ActivatorI::kill(const ServerPtr& server)
{
- pid_t pid = static_cast<pid_t>(server->getPid());
+ Ice::Int pid = server->getPid();
+ if(pid == 0)
+ {
+ //
+ // Server is already deactivated.
+ //
+ return;
+ }
+
//
// Send a SIGKILL to the process.
//
- if(::kill(pid, SIGKILL))
+ if(::kill(static_cast<pid_t>(pid), SIGKILL))
{
SyscallException ex(__FILE__, __LINE__);
ex.error = getSystemErrno();