summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2013-05-09 14:53:36 +0200
committerAndreas Gohr <andi@splitbrain.org>2013-05-09 14:54:12 +0200
commit0aa90d9aa7210ab4df4b96f23a9fc8045e572131 (patch)
tree844a2ac980536261544fc1cd15071ddc05c96e0b /inc
parent0e748a96cda77fa0131fc0b9601de54a41592ca7 (diff)
downloadrpg-0aa90d9aa7210ab4df4b96f23a9fc8045e572131.tar.gz
rpg-0aa90d9aa7210ab4df4b96f23a9fc8045e572131.tar.bz2
tar library: another fix for lone zero blocks
Diffstat (limited to 'inc')
-rw-r--r--inc/Tar.class.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/inc/Tar.class.php b/inc/Tar.class.php
index 10e82109b..d1a38ea0e 100644
--- a/inc/Tar.class.php
+++ b/inc/Tar.class.php
@@ -262,7 +262,7 @@ class Tar {
if(!$this->fh) throw new TarIOException('Could not open file for writing: '.$this->file);
}
- $this->writeaccess = false;
+ $this->writeaccess = true;
$this->closed = false;
}
@@ -295,8 +295,11 @@ class Tar {
filemtime($file)
);
- if(filesize($file)) while(!feof($fp)) {
- $packed = pack("a512", fread($fp, 512));
+ while(!feof($fp)) {
+ $data = fread($fp, 512);
+ if($data === false) break;
+ if($data === '') break;
+ $packed = pack("a512", $data);
$this->writebytes($packed);
}
fclose($fp);