Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:yukoff:openSUSE:Leap:42.1:Backports
alsa-utils
0010-speaker-test-fix-option-ordering.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0010-speaker-test-fix-option-ordering.patch of Package alsa-utils
From 4482cc7cfe97fd69b38687816a6450b0fcc9ba59 Mon Sep 17 00:00:00 2001 From: Ken Benoit <kbenoit@redhat.com> Date: Thu, 17 Sep 2015 15:06:38 -0400 Subject: [PATCH] speaker-test: fix option ordering The -c and -s options needed to be provided in a specific order for the -s option to work correctly. This pulls the speaker option check outside of the option parsing so that all the options have been parsed before checking to see if the parameter to -s is correct. Signed-off-by: Ken Benoit <kbenoit@redhat.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz> --- speaker-test/speaker-test.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c index 25970af1c9bc..5b9cbeca632d 100644 --- a/speaker-test/speaker-test.c +++ b/speaker-test/speaker-test.c @@ -1041,6 +1041,7 @@ int main(int argc, char *argv[]) { double time1,time2,time3; unsigned int n, nloops; struct timeval tv1,tv2; + int speakeroptset = 0; #ifdef CONFIG_SUPPORT_CHMAP const char *chmap = NULL; #endif @@ -1162,11 +1163,7 @@ int main(int argc, char *argv[]) { case 's': speaker = atoi(optarg); speaker = speaker < 1 ? 0 : speaker; - speaker = speaker > channels ? 0 : speaker; - if (speaker==0) { - fprintf(stderr, _("Invalid parameter for -s option.\n")); - exit(EXIT_FAILURE); - } + speakeroptset = 1; break; case 'w': given_test_wav_file = optarg; @@ -1200,6 +1197,14 @@ int main(int argc, char *argv[]) { exit(EXIT_SUCCESS); } + if (speakeroptset) { + speaker = speaker > channels ? 0 : speaker; + if (speaker==0) { + fprintf(stderr, _("Invalid parameter for -s option.\n")); + exit(EXIT_FAILURE); + } + } + if (!force_frequency) { freq = freq < 30.0 ? 30.0 : freq; freq = freq > 8000.0 ? 8000.0 : freq; -- 2.5.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor