diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2022-05-02 19:23:38 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2022-05-20 12:01:36 -0700 |
commit | c4600b2e25d4e7e7f7d6d5ab3d1819d5ec35caa2 (patch) | |
tree | 4e8e6a5cb6268f79e9cc70be3df7972a61e822c9 | |
parent | 3e596da488b575adbb9a6e1c3c0cde90be7fd160 (diff) |
FatalSignalHandler: simplify SA_RESETHAND code
And remove the unreachable code after std::abort() that was meant to
mimic that in INTEGRITY. The next commit will fix this properly.
Pick-to: 6.3
Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16eb772018add694
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
-rw-r--r-- | src/testlib/qtestcase.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 5a6aca344c..122c85ff27 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -88,6 +88,9 @@ # if !defined(Q_OS_INTEGRITY) # include <sys/resource.h> # endif +# ifndef SA_RESETHAND +# define SA_RESETHAND 0 +# endif #endif #if defined(Q_OS_MACOS) @@ -1843,6 +1846,9 @@ public: struct sigaction act; memset(&act, 0, sizeof(act)); + // Remove the handler after it is invoked. + act.sa_flags = SA_RESETHAND; + # ifdef SA_SIGINFO act.sa_flags |= SA_SIGINFO; act.sa_sigaction = FatalSignalHandler::actionHandler; @@ -1850,11 +1856,6 @@ public: act.sa_handler = FatalSignalHandler::regularHandler; # endif - // Remove the handler after it is invoked. -# if !defined(Q_OS_INTEGRITY) - act.sa_flags = SA_RESETHAND; -# endif - // tvOS/watchOS both define SA_ONSTACK (in sys/signal.h) but mark sigaltstack() as // unavailable (__WATCHOS_PROHIBITED __TVOS_PROHIBITED in signal.h) # if defined(SA_ONSTACK) && !defined(Q_OS_TVOS) && !defined(Q_OS_WATCHOS) @@ -1954,14 +1955,6 @@ private: "\n Function time: ", asyncSafeToString(msecsFunctionTime), "ms Total time: ", asyncSafeToString(msecsTotalTime), "ms\n"); std::abort(); -# if defined(Q_OS_INTEGRITY) - { - struct sigaction act; - memset(&act, 0, sizeof(struct sigaction)); - act.sa_handler = SIG_DFL; - sigaction(signum, &act, NULL); - } -# endif } [[maybe_unused]] static void regularHandler(int signum) |