tst_QProcess: silence -Wunused-result

We can't do anything about a failed write at these code locations. In
particular, we can't QVERIFY() their success, so suppress the warning
with the idiomatic cast to void.

Amends 13a1995e9dc987d1560b38d16b76442261b4aa8d,
bd32c7d7055b436b8c33486a5b5ce1c29db77fd4 and
c5221f6be00c16187e0abf008b33c230fea56c29.

Pick-to: 6.8 6.7
Change-Id: Ia7ef57f01eeb8608079a12724c0b4f03a59081c9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2024-06-17 06:34:03 +02:00
parent 8e914e07fb
commit 97f31a6879

View File

@ -1715,7 +1715,7 @@ void tst_QProcess::raiseInChildProcessModifier()
sa.sa_flags = SA_RESETHAND;
sa.sa_handler = [](int) {
static const char msg[] = "SIGUSR1 handler was run";
write(STDERR_FILENO, msg, strlen(msg));
(void)write(STDERR_FILENO, msg, strlen(msg));
raise(SIGUSR1); // re-raise
};
sigaction(SIGUSR1, &sa, nullptr);
@ -1897,8 +1897,8 @@ void tst_QProcess::unixProcessParametersAndChildModifier()
process.setChildProcessModifier([=, &vforkControl] {
const char *pgidmsg = "PGID mismatch. ";
if (getpgrp() != oldpgid)
write(pipes[1], pgidmsg, strlen(pgidmsg));
write(pipes[1], message, strlen(message));
(void)write(pipes[1], pgidmsg, strlen(pgidmsg));
(void)write(pipes[1], message, strlen(message));
vforkControl.storeRelaxed(1);
});
auto flags = QProcess::UnixProcessFlag::CloseFileDescriptors |