aboutsummaryrefslogtreecommitdiff
path: root/tinyplay.c
diff options
context:
space:
mode:
authorSimon Wilson <simonwilson@google.com>2011-08-09 16:22:40 -0700
committerSimon Wilson <simonwilson@google.com>2011-08-09 16:22:40 -0700
commitfa0697e887b383a970d726513ae804bccb7630c0 (patch)
treed623f08bf6e4bd015f3b6534412f25d7c09947d9 /tinyplay.c
parent764d341b0c8f0030844752e5fe37554c44986a11 (diff)
tinyplay: fix segfault caused by missing device argument
Diffstat (limited to 'tinyplay.c')
-rw-r--r--tinyplay.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/tinyplay.c b/tinyplay.c
index f52d76a..915a1ea 100644
--- a/tinyplay.c
+++ b/tinyplay.c
@@ -76,9 +76,12 @@ int main(int argc, char **argv)
/* parse command line arguments */
argv += 2;
- if (strcmp(*argv, "-d") == 0) {
+ while (*argv) {
+ if (strcmp(*argv, "-d") == 0) {
+ argv++;
+ device = atoi(*argv);
+ }
argv++;
- device = atoi(*argv);
}
fread(&header, sizeof(struct wav_header), 1, file);