Changeset 279

Show
Ignore:
Timestamp:
10/26/06 21:31:03 (2 years ago)
Author:
bart
Message:

Fix encoding and decoding of eA and php versions. Only three numbers

versions were encoded, this way file cache isn't removed when using
svn snapshots or rc releases.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • eaccelerator/trunk/ChangeLog

    r278 r279  
     12006-10-26  Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 
     2 
     3        * Fix encoding and decoding of eA and php versions. Only three numbers 
     4          versions were encoded, this way file cache isn't removed when using 
     5          svn snapshots or rc releases. 
     6 
    172006-10-19  Hans Rakers <hans at parse dot nl> 
    28 
    3        * Replaced short php opening tags in control.php 
    4        * Fixed typo in NEWS file 
    5        * Fix for ticket #170 (handling of multi-dim globals by the optimizer) 
     9        * Replaced short php opening tags in control.php 
     10        * Fixed typo in NEWS file 
     11        * Fix for ticket #170 (handling of multi-dim globals by the optimizer) 
    612 
    7132006-10-10  Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 
  • eaccelerator/trunk/cache.c

    r276 r279  
    269269                ea_file_header hdr; 
    270270                EACCELERATOR_FLOCK(f, LOCK_EX); 
    271                 strncpy(hdr.magic, EA_MAGIC, 8); 
    272                 hdr.eaccelerator_version = binary_eaccelerator_version; 
    273                 hdr.zend_version = binary_zend_version; 
    274                 hdr.php_version = binary_php_version; 
     271                init_header(&hdr); 
    275272                hdr.size = q->size; 
    276273                hdr.mtime = q->ttl; 
     
    388385 
    389386            EACCELERATOR_FLOCK(f, LOCK_SH); 
    390             if (read(f, &hdr, sizeof(hdr)) != sizeof(hdr) || strncmp(hdr.magic, EA_MAGIC, 8) != 0 ||  
    391                     hdr.eaccelerator_version != binary_eaccelerator_version || hdr.zend_version != binary_zend_version  
    392                     || hdr.php_version != binary_php_version) { 
     387            if (read(f, &hdr, sizeof(hdr)) != sizeof(hdr) || check_header(&hdr)) { 
    393388                EACCELERATOR_FLOCK(f, LOCK_UN); 
    394389                close(f); 
  • eaccelerator/trunk/eaccelerator.h

    r273 r279  
    337337typedef struct _ea_file_header { 
    338338        char magic[8];                          /* "EACCELERATOR" */ 
    339         int eaccelerator_version
    340         int zend_version
    341         int php_version
     339        int eaccelerator_version[2]
     340        int zend_version[2]
     341        int php_version[2]
    342342        int size; 
    343343        time_t mtime; 
    344344        unsigned int crc32; 
    345345} ea_file_header; 
     346 
     347int check_header(ea_file_header *hdr); 
     348void init_header(ea_file_header *hdr); 
    346349 
    347350typedef struct {