Skip to content
This repository was archived by the owner on Jan 17, 2019. It is now read-only.

Commit 54d191e

Browse files
authored
Merge pull request #87 from ranj063/eqctl
eqctl: do not process invalid input file name
2 parents 4c9498a + e4171c8 commit 54d191e

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

eqctl/eqctl.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <stdio.h>
3232
#include <stdlib.h>
3333
#include <stdint.h>
34+
#include <errno.h>
3435
#include <alsa/asoundlib.h>
3536

3637
#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)
6465
int n_max = smax / sizeof(unsigned int);
6566
int separator;
6667

68+
/* open input file */
6769
fh = fopen(setup, "r");
70+
if (!fh) {
71+
fprintf(stderr, "error: %s\n", strerror(errno));
72+
return -errno;
73+
}
74+
6875
while (fscanf(fh, "%u", &data[n]) != EOF && n < n_max) {
6976
if (n > 0)
7077
fprintf(stdout, ",");

0 commit comments

Comments
 (0)