summaryrefslogtreecommitdiffstats
path: root/common/file-list.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-09-27 13:58:28 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-09-27 14:02:20 +0200
commitd1ccb5df97750f0aa61bb70b173bfdfbbe4f0d6b (patch)
tree4f47363f2c841acf9a2aef365f0a8c83599b5b09 /common/file-list.c
parentbee9b68fe08dc7df01d80ec784841026345e4931 (diff)
downloadbarebox-d1ccb5df97750f0aa61bb70b173bfdfbbe4f0d6b.tar.gz
file_list: Add error messages
Add error messages when file list parsing fails. Also, forward the error from file_list_parse_one() instead of using -EINVAL for every error. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/file-list.c')
-rw-r--r--common/file-list.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/common/file-list.c b/common/file-list.c
index 0c3cb0a..8d61b76 100644
--- a/common/file-list.c
+++ b/common/file-list.c
@@ -9,6 +9,8 @@
* General Public License for more details.
*/
+#define pr_fmt(fmt) "file_list: " fmt
+
#include <common.h>
#include <malloc.h>
#include <fs.h>
@@ -91,6 +93,7 @@ static int file_list_parse_one(struct file_list *files, const char *partstr, con
flags |= FILE_LIST_FLAG_CREATE;
break;
default:
+ pr_err("Unknown flag '%c'\n", *partstr);
return -EINVAL;
}
break;
@@ -100,8 +103,10 @@ static int file_list_parse_one(struct file_list *files, const char *partstr, con
partstr++;
}
- if (state != PARSE_FLAGS)
+ if (state != PARSE_FLAGS) {
+ pr_err("Missing ')'\n");
return -EINVAL;
+ }
if (*partstr == ',')
partstr++;
@@ -121,9 +126,9 @@ struct file_list *file_list_parse(const char *str)
INIT_LIST_HEAD(&files->list);
while (*str) {
- if (file_list_parse_one(files, str, &endptr)) {
- printf("parse error\n");
- ret = -EINVAL;
+ ret = file_list_parse_one(files, str, &endptr);
+ if (ret) {
+ pr_err("parse error\n");
goto out;
}
str = endptr;