]> git.donarmstrong.com Git - samtools.git/commit
When bam_read1() returns an error (return value <= -2), propagate that error
authorOn behalf of John Marshall <lh3@sanger.ac.uk>
Wed, 22 Sep 2010 15:15:33 +0000 (15:15 +0000)
committerOn behalf of John Marshall <lh3@sanger.ac.uk>
Wed, 22 Sep 2010 15:15:33 +0000 (15:15 +0000)
commitca535cf5321de0a93406b8534f6bc03d01fb5644
tree85494c9fff8eca094caa726bc7517427da0bdca3
parent8ad43dd70c21cfdd6a965a528363511b52d25c5f
When bam_read1() returns an error (return value <= -2), propagate that error
to bam_iter_read()'s own return value.  Similarly, also propagate it up to
bam_fetch()'s return value.  Previously bam_fetch() always returned 0, and
callers ignored its return value anyway.  With this change, 0 continues to
indicate success, while <= -2 (which can be written as < 0, as -1 is never
returned) indicates corrupted input.

bam_iter_read() ought also to propagate errors returned by bam_seek().

main_samview() can now print an error message and fail when bam_fetch()
detects that a .bai index file is corrupted or otherwise does not correspond
to the .bam file it is being used with.
bam_index.c
sam_view.c