dir_import: Accept JSON data after the last object

This should really have been accepted from the start. Adding extra
elements to the top-level array might be useful for aux. data related to
the scanned files, e.g. map of seen uid/gids to names, information about
the scanned dev ids, etc. But since ncdu would throw an error on further
array elements, adding such information can't be done without breaking
compat with older versions. :(
This commit is contained in:
Yorhel 2021-05-12 16:02:07 +02:00
parent ca51d4ed1a
commit e278660464

View file

@ -568,8 +568,14 @@ static int item(uint64_t dev) {
static int footer(void) {
while(1) {
C(cons());
E(*ctx->buf != ']', "Expected ']'");
if(*ctx->buf == ']')
break;
E(*ctx->buf != ',', "Expected ',' or ']'");
con(1);
C(cons() || rval());
}
con(1);
C(cons());
E(*ctx->buf, "Trailing garbage");