Understand 'PK00' zip archives (RhBug:699529)
authorJindrich Novy <jnovy@redhat.com>
Tue, 26 Apr 2011 04:33:19 +0000 (06:33 +0200)
committerJindrich Novy <jnovy@redhat.com>
Tue, 26 Apr 2011 04:33:19 +0000 (06:33 +0200)
- it is historically used by PKZIP when storing archive to removable
  media (floppy), some java apps still use it
- thanks to Karel Klic

rpmio/rpmfileutil.c

index 4b81d97..f44eb35 100644 (file)
@@ -360,8 +360,9 @@ int rpmFileIsCompressed(const char * file, rpmCompressedMagic * compressed)
 
     if ((magic[0] == 'B') && (magic[1] == 'Z')) {
        *compressed = COMPRESSED_BZIP2;
-    } else if ((magic[0] == 0120) && (magic[1] == 0113) &&
-        (magic[2] == 0003) && (magic[3] == 0004)) {    /* pkzip */
+    } else if ((magic[0] == 'P') && (magic[1] == 'K') &&
+        (((magic[2] == 3) && (magic[3] == 4)) ||
+         ((magic[2] == '0') && (magic[3] == '0')))) {  /* pkzip */
        *compressed = COMPRESSED_ZIP;
     } else if ((magic[0] == 0xfd) && (magic[1] == 0x37) &&
               (magic[2] == 0x7a) && (magic[3] == 0x58) &&