Mixer load: don't upload empty mixers from non-existing files

This commit is contained in:
Julian Oes
2014-02-05 21:19:25 +01:00
parent 8a48a4916c
commit 3392086f8f
2 changed files with 6 additions and 3 deletions
+4 -2
View File
@@ -52,7 +52,8 @@ int load_mixer_file(const char *fname, char *buf, unsigned maxlen)
/* open the mixer definition file */
fp = fopen(fname, "r");
if (fp == NULL) {
return 1;
warnx("file not found");
return -1;
}
/* read valid lines from the file into a buffer */
@@ -88,7 +89,8 @@ int load_mixer_file(const char *fname, char *buf, unsigned maxlen)
/* if the line is too long to fit in the buffer, bail */
if ((strlen(line) + strlen(buf) + 1) >= maxlen) {
return 1;
warnx("line too long");
return -1;
}
/* add the line to the buffer */