qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Vassili Karpov (malc)" <av1474@comtv.ru>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Anthony Liguori <aliguori@amazon.com>
Subject: [Qemu-devel] [PATCH 2/2] ossaudio: check for oss support in oss_audio_init
Date: Thu,  7 Nov 2013 12:32:27 +0100	[thread overview]
Message-ID: <1383823947-5132-3-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1383823947-5132-1-git-send-email-kraxel@redhat.com>

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 <kraxel@redhat.com>
---
 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;
 }
 
-- 
1.8.3.1

      parent reply	other threads:[~2013-11-07 11:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-07 11:32 [Qemu-devel] [PULL for-1.7 0/2] ossaudio: fix oss_audio_init Gerd Hoffmann
2013-11-07 11:32 ` [Qemu-devel] [PATCH 1/2] Revert "ossaudio: do not enable by default" Gerd Hoffmann
2013-11-07 11:32 ` Gerd Hoffmann [this message]

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=1383823947-5132-3-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=aliguori@amazon.com \
    --cc=av1474@comtv.ru \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).