]> granicus.if.org Git - php/commitdiff
pack tar structs so speed optimizations don't add extra bytes to the header
authorGreg Beaver <cellog@php.net>
Sun, 9 Mar 2008 04:17:20 +0000 (04:17 +0000)
committerGreg Beaver <cellog@php.net>
Sun, 9 Mar 2008 04:17:20 +0000 (04:17 +0000)
# Steph: try this and see if it fixes Bug #13353

ext/phar/tar.h

index 3757da805c9201da1019fde6f33a98a1dff7cc17..c7ecde5bb1ebee6453e1d234ea359dd732a00b5e 100644 (file)
   +----------------------------------------------------------------------+
 */
 
+#ifdef PHP_WIN32
+#pragma pack(1)
+# define PHAR_TAR_PACK
+#else
+# define PHAR_TAR_PACK __attribute__((__packed__))
+#endif
 /**
  * the format of the header block for a file, in the older UNIX-compatible
  * TAR format
@@ -37,7 +43,7 @@ typedef struct _old_tar_header {  /* {{{ */
                                 2 for a symbolic link,
                                 0 otherwise */
        char linkname[100]; /* name of linked file */
-} old_tar_header;
+} PHAR_TAR_PACK old_tar_header;
 /* }}} */
 
 /**
@@ -74,7 +80,7 @@ typedef struct _tar_header {  /* {{{ */
                               is prefixed to the name field to allow names
                               longer then 100 characters */
        char padding[12];   /* unused zeroed bytes */
-} tar_header;
+} PHAR_TAR_PACK tar_header;
 /* }}} */
 
 #endif