Symlink fixes. Still broken, though.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 15 Jul 2002 02:22:52 +0000
changeset 340 24a11f8566f8
parent 339 a53189011712
child 341 6e25ba3e2d02
Symlink fixes. Still broken, though.
archivers/zip.c
--- a/archivers/zip.c	Sun Jul 14 15:11:47 2002 +0000
+++ b/archivers/zip.c	Mon Jul 15 02:22:52 2002 +0000
@@ -577,7 +577,7 @@
     else  /* symlink target path is compressed... */
     {
         z_stream stream;
-        PHYSFS_uint32 compsize = entry->uncompressed_size;
+        PHYSFS_uint32 compsize = entry->compressed_size;
         PHYSFS_uint8 *compressed = (PHYSFS_uint8 *) malloc(compsize);
         if (compressed != NULL)
         {
@@ -590,8 +590,11 @@
                 stream.avail_out = size;
                 if (zlib_err(inflateInit2(&stream, -MAX_WBITS)) == Z_OK)
                 {
-                    rc = (zlib_err(inflate(&stream, Z_FINISH)) == Z_OK);
+                    rc = zlib_err(inflate(&stream, Z_FINISH));
                     inflateEnd(&stream);
+
+                    /* both are acceptable outcomes... */
+                    rc = ((rc == Z_OK) || (rc == Z_STREAM_END));
                 } /* if */
             } /* if */
             free(compressed);
@@ -636,7 +639,12 @@
     return (
               (version_does_symlinks(entry->version)) &&
               (entry->uncompressed_size > 0) &&
-              (extern_attr & 0x00120000)  /* symlink flag. */
+
+            #if 0 /* !!! FIXME ... this check is incorrect for some files! */
+              (extern_attr & 0x0120000)  /* symlink flag. */
+            #else
+              0  /* always fail for now. Symlinks will just be small files. */
+            #endif
            );
 } /* entry_is_symlink */