diff --git a/src/json2torrent.c b/src/json2torrent.c index b4960fa..cd27f04 100644 --- a/src/json2torrent.c +++ b/src/json2torrent.c @@ -54,6 +54,19 @@ yajl_callbacks callbacks = { write_end /* end array */ }; +void +check_yajl_error(struct yajl_handle_t *handle, unsigned char *buf, size_t read) +{ + unsigned char *yajl_error = NULL; + + if ((yajl_error = yajl_get_error(handle, 1, buf, read)) != NULL) + { + fwrite(buf, read, 1, stderr); + fputc('\n', stderr); + yajl_free_error(handle, yajl_error); + } +} + int main(int argc, char **argv) {