summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2013-01-15 10:45:04 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2013-01-15 10:50:06 +0100
commitb5402b93d546d397db1f5aa26c9a0f82870cc6d8 (patch)
tree84c67ae0e4a7042982ee6025f1162439cd013279
parentb37a7bfbdbde859d36d0744dc5628fc5d19414ca (diff)
downloadpluggit-master.tar.gz
pluggit-master.tar.bz2
pluggit-master.zip
Add signal handler for sigpipeHEADmaster
-rw-r--r--src/Main.cxx11
-rw-r--r--src/classes.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/src/Main.cxx b/src/Main.cxx
index b4bf99a..6d0a490 100644
--- a/src/Main.cxx
+++ b/src/Main.cxx
@@ -49,6 +49,7 @@ class Main extends View, Runnable
private IDirectFBWindow m_window;
private IDirectFBSurface m_surface;
private IDirectFBEventBuffer m_events;
+ private DirectSignalHandler *m_handler;
private Source *m_source;
@@ -92,6 +93,8 @@ class Main extends View, Runnable
/* Initialize DirectFB. */
DirectFB::Init( &argc, &argv );
+ direct_signal_handler_add(SIGPIPE, Main::handle_signal, NULL, &m_handler);
+
if (!m_options.parseCommandLine( argc, argv ))
return;
@@ -538,6 +541,14 @@ class Main extends View, Runnable
else
D_ERROR( "IDiVine interface is null!\n" );
}
+
+ public static DirectSignalHandlerResult
+ handle_signal(int num, void *addr, void *ctx)
+ {
+ exit(13);
+ return DSHR_OK;
+ }
+
};
}
diff --git a/src/classes.h b/src/classes.h
index 2d8228b..33bdbd3 100644
--- a/src/classes.h
+++ b/src/classes.h
@@ -26,6 +26,7 @@ extern "C" {
#include <direct/messages.h>
#include <direct/thread.h>
#include <direct/util.h>
+#include <direct/signals.h>
#include <gfx/convert.h>