* @brief Exit handlers for the eVaf main executable
* @author Enar Vaikene
*
- * Copyright (c) 2011 Enar Vaikene
+ * Copyright (c) 2011-2019 Enar Vaikene
*
* This file is part of the eVaf C++ cross-platform application development framework.
*
#include <QtCore>
-#ifdef Q_OS_LINUX
+#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
# include <signal.h>
#endif
namespace GUI {
namespace Internal {
-#ifdef Q_OS_LINUX
+#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
/**
* Signal handler on Linux
} // namespace eVaf::GUI
} // namespace eVaf
-using namespace eVaf::GUI::Internal;
-bool installExitHandler()
+bool eVaf::GUI::Internal::installExitHandler()
{
-#ifdef Q_OS_LINUX
+#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
struct sigaction sa;
memset(&sa, 0, sizeof(sa));
sa.sa_handler = signalHandler;
- if (sigaction(SIGTERM, &sa, NULL) != 0) {
+ if (sigaction(SIGTERM, &sa, nullptr) != 0) {
EVAF_FATAL_ERROR("sigaction() failed: %m");
return false;
}
- if (sigaction(SIGHUP, &sa, NULL) != 0) {
+ if (sigaction(SIGHUP, &sa, nullptr) != 0) {
EVAF_FATAL_ERROR("sigaction() failed: %m");
return false;
}