/* correct-powerpc-3.c Corrects the Debian 2.2 rev0 powerpc Binary-3 CD for a single-bit error. COMPILE: gcc -Wall -O2 -o correct-powerpc-3 correct-powerpc-3.c USAGE: ./correct-powerpc-3 binary-powerpc-3.iso NOTE: This is an in-place correction - it doesn't require any disk space. Old md5sum: 9cdf11f2aa3a37d0705eef68a97b0965 binary-powerpc-3.iso New md5sum: dfb47ee49c8234127f5483432d612a5a binary-powerpc-3.iso Copyright (C) 2000 J.A. Bezemer Licensed under GNU GPL -- NO WARRANTY WHATSOEVER -- USE AT YOUR OWN RISK! */ #include #define POS 0x0a1ef4de /* Or 0x5da4de to correct gimp-manual_1.0.0-4.deb when copied from the CD. */ #define OLD 0xb8 #define NEW 0xb0 int main (int argc, char *argv[]) { FILE *f; unsigned char o, n = NEW; if (argc == 2 && (f = fopen (argv[1], "r+")) != NULL && fseek (f, POS, SEEK_SET) == 0 && fread (&o, 1, 1, f) == 1 && o == OLD && fseek (f, POS, SEEK_SET) == 0 && fwrite (&n, 1, 1, f) == 1 && fclose (f) == 0) { fprintf (stderr, "Correction successful\n"); return 0; } else { fprintf (stderr, "Usage error, file error, wrong file or already " "converted file\n"); perror ("This may be the error message"); return 1; } }