Merge pull request #87 from ranj063/eqctl

eqctl: do not process invalid input file name
This commit is contained in:
Liam Girdwood 2018-10-02 08:32:38 +01:00 committed by GitHub
commit 54d191e82b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -31,6 +31,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <errno.h>
#include <alsa/asoundlib.h>
#define SOF_CTRL_CMD_BINARY 3 /* TODO: From uapi ipc */
@ -64,7 +65,13 @@ static int read_setup(unsigned int *data, char setup[], size_t smax)
int n_max = smax / sizeof(unsigned int);
int separator;
/* open input file */
fh = fopen(setup, "r");
if (!fh) {
fprintf(stderr, "error: %s\n", strerror(errno));
return -errno;
}
while (fscanf(fh, "%u", &data[n]) != EOF && n < n_max) {
if (n > 0)
fprintf(stdout, ",");