tmbinc / bgrep

Binary Grep
http://debugmo.de/2009/04/bgrep-a-binary-grep/
368 stars 57 forks source link

`-B` fails with `lseek: Invalid argument` if it would start before the beginning of the file #16

Open cirosantilli opened 1 year ago

cirosantilli commented 1 year ago

Would be better to just start from 0 instead in that case:

printf '\x01\x02\x03' > tmp

Good:

bgrep -B2 03 tmp

output:

tmp: 00000002
\x01\x02

Bad:

bgrep -B3 03 tmp

output:

tmp: 00000002
lseek: Invalid argument