From: Mark Wooding Date: Fri, 18 Feb 2022 22:57:13 +0000 (+0000) Subject: dvd-sector-copy.c: Fix final recovery. X-Git-Url: https://git.distorted.org.uk/~mdw/dvdrip/commitdiff_plain/a8625592998b9086b8f5f2df40f8f40709c15921 dvd-sector-copy.c: Fix final recovery. Write this the other way around, because it's easier to read that way. And then notice that it's broken because it doesn't actually set the return value properly. --- diff --git a/dvd-sector-copy.c b/dvd-sector-copy.c index dd97d8b..98ee8ec 100644 --- a/dvd-sector-copy.c +++ b/dvd-sector-copy.c @@ -710,10 +710,12 @@ static ssize_t find_good_sector(secaddr *pos_inout, secaddr end, else bad_hi = pos + n + 1; } recovered(bad_lo, bad_hi); *pos_inout = good; - if (r.pos + r.start <= good && good <= r.pos + r.end) { - rearrange_sectors(&r, 0, good - r.pos, r.pos + r.end - good); - } else + if (good < r.pos + r.start || r.pos + r.end <= good) n = 0; + else { + n = r.pos + r.end - good; + rearrange_sectors(&r, 0, good - r.pos, n); + } return (n); }