All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>
Subject: [PULL 02/13] libqtest: check for g_setenv() failure
Date: Thu,  2 Sep 2021 14:49:00 +0200	[thread overview]
Message-ID: <20210902124911.822423-3-thuth@redhat.com> (raw)
In-Reply-To: <20210902124911.822423-1-thuth@redhat.com>

From: Peter Maydell <peter.maydell@linaro.org>

g_setenv() can fail; check for it when starting a QEMU process
when we set the QEMU_AUDIO_DRV environment variable.

Because this happens after fork() reporting an exact message
via printf() is a bad idea; just exit(1), as we already do
for the case of execlp() failure.

Fixes: Coverity CID 1460117
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210820163750.9106-1-peter.maydell@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/qtest/libqtest.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 825b13a44c..73f6b977a6 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -301,7 +301,9 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args)
     s->expected_status = 0;
     s->qemu_pid = fork();
     if (s->qemu_pid == 0) {
-        g_setenv("QEMU_AUDIO_DRV", "none", true);
+        if (!g_setenv("QEMU_AUDIO_DRV", "none", true)) {
+            exit(1);
+        }
         execlp("/bin/sh", "sh", "-c", command, NULL);
         exit(1);
     }
-- 
2.27.0



  parent reply	other threads:[~2021-09-02 13:06 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-02 12:48 [PULL 00/13] Testing, build system and misc patches Thomas Huth
2021-09-02 12:48 ` [PULL 01/13] docs: add definitions of terms for CI/testing Thomas Huth
2021-09-02 12:49 ` Thomas Huth [this message]
2021-09-02 12:49 ` [PULL 03/13] gitlab-ci: Merge "build-disabled" with "build-without-default-features" Thomas Huth
2021-09-02 12:49 ` [PULL 04/13] gitlab-ci: Remove superfluous "dnf install" statement Thomas Huth
2021-09-02 12:49 ` [PULL 05/13] gitlab-ci: Fix ..._RUNNER_AVAILABLE variables and document them Thomas Huth
2021-09-02 12:49 ` [PULL 06/13] gitlab-ci: Don't try to use the system libfdt in the debian job Thomas Huth
2021-09-02 12:49 ` [PULL 07/13] meson.build: Fix the check for a usable libfdt Thomas Huth
2021-09-02 12:49 ` [PULL 08/13] meson.build: Don't use internal libfdt if the user requested the system libfdt Thomas Huth
2021-09-02 12:49 ` [PULL 09/13] configure / meson: Move the GBM handling to meson.build Thomas Huth
2021-09-02 12:49 ` [PULL 10/13] scripts: Remove the "show-fixed-bugs.sh" file Thomas Huth
2021-09-02 12:49 ` [PULL 11/13] softmmu/vl: Add a "grab-mod" parameter to the -display sdl option Thomas Huth
2021-09-02 12:49 ` [PULL 12/13] softmmu/vl: Deprecate the old grab options Thomas Huth
2021-09-02 12:49 ` [PULL 13/13] softmmu/vl: Deprecate the -sdl and -curses option Thomas Huth
2021-09-03 13:22 ` [PULL 00/13] Testing, build system and misc patches Peter Maydell
2021-09-03 14:19   ` Thomas Huth
2021-09-03 16:35     ` Alex Bennée
2021-09-03 16:49       ` Peter Maydell
2021-09-06  9:51         ` Thomas Huth
2021-09-06 15:08           ` Paolo Bonzini
2021-09-06 15:14             ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210902124911.822423-3-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.