All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] alsa-utils: speaker-test: fix infinite loop
@ 2010-10-15 10:35 David Henningsson
  2010-10-17  8:18 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: David Henningsson @ 2010-10-15 10:35 UTC (permalink / raw)
  To: ALSA Development Mailing List, Takashi Iwai

[-- Attachment #1: Type: text/plain, Size: 530 bytes --]

I'm using speaker-test in an Ubuntu-specific bug triaging 
script/application ("ubuntu-bug audio"), and without showing the 
terminal that speaker-test outputs. So when the stream cannot be opened 
for one reason or another, my application hangs indefinitely and the 
user cannot report the bug.

Looking at the code, seems like Takashi removed all error loops except 
this one four years ago, so there shouldn't be any controversy in 
removing this one as well.

-- 
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic

[-- Attachment #2: 0001-speaker-test-Don-t-retry-after-fatal-errors.patch --]
[-- Type: text/x-patch, Size: 1045 bytes --]

>From f51771c4064ec5f18ec46aeec2d5fe294a4a372c Mon Sep 17 00:00:00 2001
From: David Henningsson <david.henningsson@canonical.com>
Date: Fri, 15 Oct 2010 12:30:44 +0200
Subject: [PATCH] speaker-test: Don't retry after fatal errors

Fixup commit 9b1a2566: Remove error loop

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
---
 speaker-test/speaker-test.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c
index 458a8d7..3029110 100644
--- a/speaker-test/speaker-test.c
+++ b/speaker-test/speaker-test.c
@@ -993,9 +993,9 @@ int main(int argc, char *argv[]) {
 
   }
 
-  while ((err = snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
+  if ((err = snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
     printf(_("Playback open error: %d,%s\n"), err,snd_strerror(err));
-    sleep(1);
+    exit(EXIT_FAILURE);
   }
 
   if ((err = set_hwparams(handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) {
-- 
1.7.1


[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] alsa-utils: speaker-test: fix infinite loop
  2010-10-15 10:35 [PATCH] alsa-utils: speaker-test: fix infinite loop David Henningsson
@ 2010-10-17  8:18 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2010-10-17  8:18 UTC (permalink / raw)
  To: David Henningsson; +Cc: ALSA Development Mailing List

At Fri, 15 Oct 2010 12:35:31 +0200,
David Henningsson wrote:
> 
> I'm using speaker-test in an Ubuntu-specific bug triaging 
> script/application ("ubuntu-bug audio"), and without showing the 
> terminal that speaker-test outputs. So when the stream cannot be opened 
> for one reason or another, my application hangs indefinitely and the 
> user cannot report the bug.
> 
> Looking at the code, seems like Takashi removed all error loops except 
> this one four years ago, so there shouldn't be any controversy in 
> removing this one as well.

Looks good to me.
Applied now.  Thanks!


Takashi


> 
> -- 
> David Henningsson, Canonical Ltd.
> http://launchpad.net/~diwic
> [2 0001-speaker-test-Don-t-retry-after-fatal-errors.patch <text/x-patch (7bit)>]
> >From f51771c4064ec5f18ec46aeec2d5fe294a4a372c Mon Sep 17 00:00:00 2001
> From: David Henningsson <david.henningsson@canonical.com>
> Date: Fri, 15 Oct 2010 12:30:44 +0200
> Subject: [PATCH] speaker-test: Don't retry after fatal errors
> 
> Fixup commit 9b1a2566: Remove error loop
> 
> Signed-off-by: David Henningsson <david.henningsson@canonical.com>
> ---
>  speaker-test/speaker-test.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c
> index 458a8d7..3029110 100644
> --- a/speaker-test/speaker-test.c
> +++ b/speaker-test/speaker-test.c
> @@ -993,9 +993,9 @@ int main(int argc, char *argv[]) {
>  
>    }
>  
> -  while ((err = snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
> +  if ((err = snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
>      printf(_("Playback open error: %d,%s\n"), err,snd_strerror(err));
> -    sleep(1);
> +    exit(EXIT_FAILURE);
>    }
>  
>    if ((err = set_hwparams(handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) {
> -- 
> 1.7.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-17  8:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-15 10:35 [PATCH] alsa-utils: speaker-test: fix infinite loop David Henningsson
2010-10-17  8:18 ` Takashi Iwai

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.