Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp755182iog; Fri, 17 Jun 2022 12:53:34 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vRBr3ILZ/DNPPv3jm6yboPA/34i3JRSQsCXPB1Xjgbvof+JwNPrjv0aqPhb7OuhzJU15wx X-Received: by 2002:a17:90b:11c5:b0:1ea:9747:28ba with SMTP id gv5-20020a17090b11c500b001ea974728bamr23536200pjb.22.1655495613955; Fri, 17 Jun 2022 12:53:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655495613; cv=none; d=google.com; s=arc-20160816; b=CbuL2m03krQtHFlp5p8TH5JbniAV5qlb9dmNIt1h28m4w5CrVGVl11k1hht2rIp8/N d9L+ZhJSDdk9hYkGK7aYilxrMzcCASm9KYvxyqNWEMoEoWcymRJGXHjLejZBNzQsJpHT RbF9Of4QWJb+kNFpb83vY/GLtuiAyUnDtGZ++VQcB6uiVOUHi0EZvp7PZMK7Lqc/P4uY x3IAvHejSruOyYYr7AaqmHLi3c1HG5sNmPMh8RYqyMFwJhEE9SUmYyTNSBKjH9b0InHl eOUQipOZFioXqieOyBIK14KqKFnBxdAfO8C5UTOCHixIcP5mFUz3hdt4Z4PwzxE+jLgg jo4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=B0VN6hcrr1dGThoh02+VPBP0inYt5ygSZoI8PlWjsyQ=; b=lcRvQIN4qIJa3h+hxF9c0wC41xbnTpCVb82cyAQcOsbfQEU2WSLt4UAI+73BpkX2v/ em7NgEZtzYyPzHclhyvqP/boidl7zLkYpqT0lQvBqRWj+otk8GzwEp1Vfo5wV+tRQyWd B6x2YXFf+T3CjqJrSsnEWkYNgAb3FmUCWv0BhjpQDedtHoGOyLVtbaBb2hA7z02ISjPh WlmQRgdVQdfvwDw6RW/4l8wQHvnxA8Af9a2rJVENunIYTc0yy9ZYHsHhbhpi1XlBjDjr 66rTFN1Riuww1F6gcYK2DEFpttjHDcyVGkQU30g929F2/g6gCWLdtsWNtYMxs2HGEiHH 0tvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=TberD4Dq; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p3-20020a62d003000000b005189da52427si7564179pfg.345.2022.06.17.12.53.01; Fri, 17 Jun 2022 12:53:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=TberD4Dq; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233830AbiFQTto (ORCPT + 99 others); Fri, 17 Jun 2022 15:49:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234172AbiFQTtm (ORCPT ); Fri, 17 Jun 2022 15:49:42 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C764286E0 for ; Fri, 17 Jun 2022 12:49:38 -0700 (PDT) Received: from localhost.localdomain (67.227.121.78.rev.sfr.net [78.121.227.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: fdanis) by madras.collabora.co.uk (Postfix) with ESMTPSA id CF993660179B for ; Fri, 17 Jun 2022 20:49:36 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1655495376; bh=LZEWs6sDWy32jeWlvKDEMbHToL9/xzBo22z0mEsZWZk=; h=From:To:Subject:Date:From; b=TberD4DqCFjUm18M6SY6Uas0A2MDyBnCx/XpFLer7+aE4Ed0AzNvZMxpvL6hemJxo UXJ+TkAI6bJwV+YaCSWkkPHCstplhGnoqm3ACwm4mrVK+iTSOwiDLPuGQGlPV3/awh 00W2zv0WyLLZpeOk4/fccdr+OOuxGeD/RzRWZR1a5AwmFsS5zPUUZ4eWtVQOHy2LY3 AS7iTy9q7Ory8kwroT7Eav2lM8kALxLyIQpS3uelz6D989T03vfUWg7PVkZDaze9h/ WBypwTfOfmuqFJXeUJEkcPQ1GH6UxGJRGCMG9tJP4YboSsa2+BQ1dfLclGHHLdzl3K LCNu0RrXrH2IQ== From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Danis?= To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ] test-runner: Fix issues found by coverity Date: Fri, 17 Jun 2022 21:49:29 +0200 Message-Id: <20220617194929.95991-1-frederic.danis@collabora.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org --- tools/test-runner.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tools/test-runner.c b/tools/test-runner.c index 49fc21325..6886d66c6 100644 --- a/tools/test-runner.c +++ b/tools/test-runner.c @@ -275,6 +275,10 @@ static void start_qemu(void) char *xdg_runtime_dir, *audiodev; xdg_runtime_dir = getenv("XDG_RUNTIME_DIR"); + if (!xdg_runtime_dir) { + fprintf(stderr, "XDG_RUNTIME_DIR not set\n"); + exit(1); + } audiodev = alloca(40 + strlen(xdg_runtime_dir)); sprintf(audiodev, "id=audio,driver=pa,server=%s/pulse/native", xdg_runtime_dir); @@ -474,8 +478,14 @@ static void create_dbus_session_conf(void) "/usr/share/dbus-1/session.conf") < 0) perror("Failed to create session.conf symlink"); - mkdir("/run/user", 0755); - mkdir("/run/user/0", 0755); + if (mkdir("/run/user", 0755) < 0) { + fprintf(stderr, "unable to create /run/user directory\n"); + return; + } + if (mkdir("/run/user/0", 0755) < 0) { + fprintf(stderr, "unable to create /run/user/0 directory\n"); + return; + } } static pid_t start_dbus_daemon(bool session) @@ -919,7 +929,7 @@ start_next: if (corpse == dbus_session_pid) { printf("D-Bus session daemon terminated\n"); - dbus_pid = -1; + dbus_session_pid = -1; } if (corpse == daemon_pid) { -- 2.25.1