From patchwork Thu Nov 7 11:32:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 289300 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B6AAC2C03A2 for ; Thu, 7 Nov 2013 22:33:24 +1100 (EST) Received: from localhost ([::1]:39733 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeNpy-0000pN-5l for incoming@patchwork.ozlabs.org; Thu, 07 Nov 2013 06:33:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57088) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeNpX-0000f0-EE for qemu-devel@nongnu.org; Thu, 07 Nov 2013 06:33:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VeNpR-00070k-Ey for qemu-devel@nongnu.org; Thu, 07 Nov 2013 06:32:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45614) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeNpR-00070L-7h for qemu-devel@nongnu.org; Thu, 07 Nov 2013 06:32:49 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rA7BWdGO031357 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 7 Nov 2013 06:32:39 -0500 Received: from nilsson.home.kraxel.org (dhcp-160-178.ber.redhat.com [10.32.160.178]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rA7BWces029359; Thu, 7 Nov 2013 06:32:38 -0500 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 0A1F8805AF; Thu, 7 Nov 2013 12:32:38 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 7 Nov 2013 12:32:27 +0100 Message-Id: <1383823947-5132-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1383823947-5132-1-git-send-email-kraxel@redhat.com> References: <1383823947-5132-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: "Vassili Karpov \(malc\)" , Gerd Hoffmann , Anthony Liguori Subject: [Qemu-devel] [PATCH 2/2] ossaudio: check for oss support in oss_audio_init X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Check whenever the device path (/dev/dsp by default) exists and qemu is allowed to access it. Return NULL if it isn't, so ossaudio will not be used on systems wihtout oss support (increasinly common on modern linux systems). Signed-off-by: Gerd Hoffmann --- audio/ossaudio.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/audio/ossaudio.c b/audio/ossaudio.c index 007c641..5a73716 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -849,6 +849,10 @@ static int oss_ctl_in (HWVoiceIn *hw, int cmd, ...) static void *oss_audio_init (void) { + if (access(conf.devpath_in, R_OK | W_OK) < 0 || + access(conf.devpath_out, R_OK | W_OK) < 0) { + return NULL; + } return &conf; }