mirror of
https://github.com/json-c/json-c.git
synced 2026-09-08 00:56:50 +08:00
Fix json_parse:exit with error when input file cannot be opened
This commit is contained in:
@@ -217,6 +217,11 @@ int main(int argc, char **argv)
|
||||
{
|
||||
fname = argv[optind];
|
||||
fd = open(fname, O_RDONLY, 0);
|
||||
if (fd < 0)
|
||||
{
|
||||
fprintf(stderr, "error opening %s: %s\n", fname, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
showmem();
|
||||
if (parseit(fd, showobj) != 0)
|
||||
|
||||
Reference in New Issue
Block a user