summaryrefslogtreecommitdiffstats
path: root/lib/private/files/stream
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2013-10-25 12:09:46 +0200
committerVincent Petry <pvince81@owncloud.com>2013-10-25 12:09:46 +0200
commitd8b245490bf0e74156c66ca594977cbdb2920c4e (patch)
treecc971cb023b81d93684cc2a80a6807105ccdbaeb /lib/private/files/stream
parent5fd1f552a3de82c17f2ced20334888516d3fb9b7 (diff)
downloadnextcloud-server-d8b245490bf0e74156c66ca594977cbdb2920c4e.tar.gz
nextcloud-server-d8b245490bf0e74156c66ca594977cbdb2920c4e.zip
Fixed quota stream's fseek method
- Added missing return statement - Added missing support for SEEK_END - Fixes #5524
Diffstat (limited to 'lib/private/files/stream')
-rw-r--r--lib/private/files/stream/quota.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/private/files/stream/quota.php b/lib/private/files/stream/quota.php
index 53d8a03d30f..87301c23614 100644
--- a/lib/private/files/stream/quota.php
+++ b/lib/private/files/stream/quota.php
@@ -66,12 +66,22 @@ class Quota {
}
public function stream_seek($offset, $whence = SEEK_SET) {
- if ($whence === SEEK_SET) {
+ if ($whence === SEEK_END){
+ // go to the end to find out last position's offset
+ $oldOffset = $this->stream_tell();
+ if (fseek($this->source, 0, $whence) !== 0){
+ return false;
+ }
+ $whence = SEEK_SET;
+ $offset = $this->stream_tell() + $offset;
+ $this->limit += $oldOffset - $offset;
+ }
+ else if ($whence === SEEK_SET) {
$this->limit += $this->stream_tell() - $offset;
} else {
$this->limit -= $offset;
}
- fseek($this->source, $offset, $whence);
+ return !fseek($this->source, $offset, $whence);
}
public function stream_tell() {