Tidy up QTest::FatalSignalHandler

Rename some variables: avoid abbreviated names.
(Don't bother with renaming variables an imminent commit removes, though.)

Pick-to: 6.2 6.3
Change-Id: I3bd11f37ca687047555d43dff83c3c2f935135d8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Samuel Mira 2022-02-25 13:33:06 +01:00 committed by Edward Welbourne
parent fcecaf53f5
commit 38a86afcc4

View File

@ -1727,8 +1727,8 @@ public:
// Block all fatal signals in our signal handler so we don't try to close
// the testlog twice.
sigemptyset(&act.sa_mask);
for (int sig : fatalSignals)
sigaddset(&act.sa_mask, sig);
for (int signal : fatalSignals)
sigaddset(&act.sa_mask, signal);
// The destructor can only restore SIG_DFL, so only register for signals
// that had default handling previously.
@ -1744,14 +1744,14 @@ public:
};
struct sigaction oldact;
for (int sig : fatalSignals) {
for (int signal : fatalSignals) {
// Registering reveals the existing handler:
if (sigaction(sig, &act, &oldact))
if (sigaction(signal, &act, &oldact))
continue; // Failed to set our handler; nothing to restore.
if (isDefaultHandler(oldact))
sigaddset(&handledSignals, sig);
sigaddset(&handledSignals, signal);
else // Restore non-default handler:
sigaction(sig, &oldact, nullptr);
sigaction(signal, &oldact, nullptr);
}
#endif // defined(Q_OS_UNIX) && !defined(Q_OS_WASM)
}
@ -1772,16 +1772,16 @@ public:
return old.sa_handler == FatalSignalHandler::signal;
# endif
};
struct sigaction oldact;
struct sigaction action;
for (int i = 1; i < 32; ++i) {
if (!sigismember(&handledSignals, i))
for (int signum = 1; signum < 32; ++signum) {
if (!sigismember(&handledSignals, signum))
continue;
if (sigaction(i, nullptr, &oldact))
if (sigaction(signum, nullptr, &action))
continue; // Failed to query present handler
if (isOurs(oldact))
sigaction(i, &act, nullptr);
if (isOurs(action))
sigaction(signum, &act, nullptr);
}
#endif
}