summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-07-17 15:58:51 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-07-17 15:58:51 +0200
commitdb9ffc6dafce568e0b70d064411db81933d61eb4 (patch)
treeeba77633fc2c2c18f4628a8b7ab26927b7553f0e
parent37ab187408799ba3f3f9107bdc5a72fea0b4b608 (diff)
downloadabrt-db9ffc6dafce568e0b70d064411db81933d61eb4.tar.gz
abrt-db9ffc6dafce568e0b70d064411db81933d61eb4.tar.xz
abrt-db9ffc6dafce568e0b70d064411db81933d61eb4.zip
On exit, take care to emit consistent exit status.
If we were Ctrl-C'ed, then we should exit by killing ourself, not exit(N). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--src/Daemon/Daemon.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp
index c28331fc..dff8de6c 100644
--- a/src/Daemon/Daemon.cpp
+++ b/src/Daemon/Daemon.cpp
@@ -42,13 +42,14 @@ void print_help()
int main(int argc, char** argv)
{
int daemonize = 1;
- /*signal handlers */
+
+ /* signal handlers */
signal(SIGTERM, handle_fatal_signal);
signal(SIGINT, handle_fatal_signal);
+
try
{
-
- if (argc > 1)
+ if (argv[1])
{
if (strcmp(argv[1], "-d") == 0)
{
@@ -97,7 +98,14 @@ int main(int argc, char** argv)
{
std::cerr << "Cannot create daemon: " << e.what() << std::endl;
}
+
delete g_pCrashWatcher;
- return 1; /* Any exit is a failure. Normally we don't exit at all */
-}
+ /* Take care to emit correct exit status */
+ if (sig_caught) {
+ signal(sig_caught, SIG_DFL);
+ raise(sig_caught);
+ }
+ /* I think we never end up here */
+ return 0;
+}