]> Dogcows Code - chaz/tar/commitdiff
*** empty log message ***
authorFrançois Pinard <pinard@iro.umontreal.ca>
Wed, 16 Nov 1994 02:56:03 +0000 (02:56 +0000)
committerFrançois Pinard <pinard@iro.umontreal.ca>
Wed, 16 Nov 1994 02:56:03 +0000 (02:56 +0000)
src/list.c

index c26c8833c77c02109be3ea0ff0bd4357e98b1465..7f5aac93a057701a13ea64fa04baf45267689f6f 100644 (file)
@@ -289,7 +289,7 @@ int
 read_header()
 {
        register int    i;
-       register long   sum, recsum;
+       register long   sum, signed_sum, recsum;
        register char   *p;
        register union record *header;
        long    from_oct();
@@ -315,13 +315,18 @@ read_header()
                 * We can't use unsigned char here because of old compilers,
                 * e.g. V7.
                 */
+               signed_sum += *p;
                sum += 0xFF & *p++;
        }
 
        /* Adjust checksum to count the "chksum" field as blanks. */
        for (i = sizeof(header->header.chksum); --i >= 0;)
+         {
                sum -= 0xFF & header->header.chksum[i];
+               signed_sum -= (char) header->header.chksum[i];
+         }
        sum += ' '* sizeof header->header.chksum;       
+       signed_sum += ' ' * sizeof header->header.chksum;
 
        if (sum == 8*' ') {
                /*
@@ -331,7 +336,7 @@ read_header()
                return 2;
        }
 
-       if (sum != recsum) 
+       if (sum != recsum && signed_sum != recsum
          return 0;
        
        /*
This page took 0.027846 seconds and 4 git commands to generate.