File tree 1 file changed +3
-6
lines changed
1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -663,27 +663,24 @@ get_bson_from_json_file (char *filename)
663
663
664
664
file = fopen (filename , "rb" );
665
665
if (!file ) {
666
- return NULL ;
666
+ test_error ( "Failed to open JSON file: %s" , filename ) ;
667
667
}
668
668
669
669
/* get file length */
670
670
fseek (file , 0 , SEEK_END );
671
671
length = ftell (file );
672
672
fseek (file , 0 , SEEK_SET );
673
673
if (length < 1 ) {
674
- return NULL ;
674
+ test_error ( "Failed to read length of JSON file: %s" , filename ) ;
675
675
}
676
676
677
677
/* read entire file into buffer */
678
678
buffer = (const char * ) bson_malloc0 (length );
679
679
if (fread ((void * ) buffer , 1 , length , file ) != length ) {
680
- test_error ("Failed to read JSON file into buffer" );
680
+ test_error ("Failed to read JSON file into buffer: %s" , filename );
681
681
}
682
682
683
683
fclose (file );
684
- if (!buffer ) {
685
- return NULL ;
686
- }
687
684
688
685
/* convert to bson */
689
686
data = bson_new_from_json ((const uint8_t * ) buffer , length , & error );
You can’t perform that action at this time.
0 commit comments