return parse errors via IPC for append_layout

This commit is contained in:
Michael Stapelberg
2014-01-04 21:39:13 +01:00
parent 1d969e6340
commit 58b3c730e2
4 changed files with 17 additions and 6 deletions

View File

@ -384,7 +384,7 @@ static int json_double(void *ctx, double val) {
return 1;
}
void tree_append_json(const char *filename) {
void tree_append_json(const char *filename, char **errormsg) {
FILE *f;
if ((f = fopen(filename, "r")) == NULL) {
LOG("Cannot open file \"%s\"\n", filename);
@ -441,6 +441,8 @@ void tree_append_json(const char *filename) {
{
unsigned char *str = yajl_get_error(hand, 1, (const unsigned char*)buf, n);
ELOG("JSON parsing error: %s\n", str);
if (errormsg != NULL)
*errormsg = sstrdup((const char*)str);
yajl_free_error(hand, str);
/* In case not all containers were restored, we need to fix the