Post
Topic
Board Development & Technical Discussion
Re: Bitcoin private key/wallet.dat data recovery patch
by
thefreshprinceofbell
on 09/03/2021, 21:13:10 UTC
Quote
static int refill_buf(void) {
   int ret;
   //printf("refill_buf: fill = %i pos = %i\n", buffill, bufpos);
   if(bufpos > BUF_WATERMARK) {
      memcpy(buf, buf + BUF_SEGMENT, BUF_LEN-BUF_SEGMENT);
      buffill -= BUF_SEGMENT;
      bufpos -= BUF_SEGMENT;
   }
   if(buffill < BUF_LEN) {
      ret = read(f, buf+buffill, BUF_LEN-buffill);
      if(ret < 0) {
         printf("Device read jumping");
         return ret;
      }
      //printf("Read %i bytes\n", ret);
      buffill += ret;
      fpos += ret;
      if(fpos > fnextcp) {
         show_progress();
         fnextcp = fpos + (ftotallen/1024);
      }
      return ret;
   } else {
      return -1;
   }
}

Maybe this will do it.