Menu

par-cmdline breaks with Mingw32...

2002-03-31
2002-11-13
  • Thomas Fjellstrom

    par-cmdline compiles fine, in fact its more like great, with mingw32, but when I try to check or recover a parchive par says that the par file is corrupt. (something about a hash mismatch)

     
    • Jeremie Allard

      Jeremie Allard - 2002-11-12

      in file fileops.c, line 188 (begining of function do_open), replace the line

      if (i >= 0) f->f = fdopen(i, f->wr ? "w+b" : "rb");

      with

      if (i >= 0)
      {
        close(i);
        f->f=fopen(f->name, f->wr ? "w+b" : "rb");
      }

      apparently there is a bug in function fdopen, only the beginning of the file was read.

       
      • Nobody/Anonymous

        The original code looks correct and I believe is the better way to do it.
        Has the fdopen bug in mingw32 been fixed? Perhaps upgrading the library
        to fix the bug would be a better solution.

        The reason I feel like the original is better is that it prevents creating
        a unique file, then having another process create the same unique file
        between the close() and fopen() calls.  Of course, the scenario described
        above would be VERY unlikely, so it's not that big of deal.

        Regards,
        Kerry

         

Log in to post a comment.