diff options
author | Simon Wilson <simonwilson@google.com> | 2011-08-09 16:22:40 -0700 |
---|---|---|
committer | Simon Wilson <simonwilson@google.com> | 2011-08-09 16:22:40 -0700 |
commit | fa0697e887b383a970d726513ae804bccb7630c0 (patch) | |
tree | d623f08bf6e4bd015f3b6534412f25d7c09947d9 | |
parent | 764d341b0c8f0030844752e5fe37554c44986a11 (diff) |
tinyplay: fix segfault caused by missing device argument
-rw-r--r-- | tinyplay.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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); |