Commit a6df3550 authored by Marc Hoersken's avatar Marc Hoersken
Browse files

tool_metalink.c: Fixed validation of binary files containing EOF

Since Windows/MinGW threat 0x1A as the EOF character, reading binary
files which contain that byte does not work using text mode.
The read function will only read until the first 0x1A byte. This
means that the hash is not computed from the whole file and the
final validation check using hash comparision fails.
parent 8a57b3c9
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -339,7 +339,8 @@ static int check_hash(const char *filename,
  digest_context *dctx;
  int check_ok;
  int fd;
  fd = open(filename, O_RDONLY);
  /* O_BINARY is required in order to avoid binary EOF in text mode */
  fd = open(filename, O_RDONLY | O_BINARY);
  if(fd == -1) {
    fprintf(error, "Metalink: validating (%s) FAILED (%s)\n", filename,
            strerror(errno));