Stream::ReadAt()/WriteAt() now return B_BAD_VALUE if the read/write
position was set to a value lower than zero (as Posix demands). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4650 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -365,8 +365,8 @@ Stream<Cache>::ReadAt(off_t pos, uint8 *buffer, size_t *_length)
|
|||||||
// set/check boundaries for pos/length
|
// set/check boundaries for pos/length
|
||||||
|
|
||||||
if (pos < 0)
|
if (pos < 0)
|
||||||
pos = 0;
|
return B_BAD_VALUE;
|
||||||
else if (pos >= Node()->data.size) {
|
if (pos >= Node()->data.size) {
|
||||||
*_length = 0;
|
*_length = 0;
|
||||||
return B_NO_ERROR;
|
return B_NO_ERROR;
|
||||||
}
|
}
|
||||||
@@ -489,8 +489,8 @@ Stream<Cache>::WriteAt(Transaction *transaction, off_t pos, const uint8 *buffer,
|
|||||||
|
|
||||||
// set/check boundaries for pos/length
|
// set/check boundaries for pos/length
|
||||||
if (pos < 0)
|
if (pos < 0)
|
||||||
pos = 0;
|
return B_BAD_VALUE;
|
||||||
else if (pos + length > Node()->data.size) {
|
if (pos + length > Node()->data.size) {
|
||||||
off_t oldSize = Size();
|
off_t oldSize = Size();
|
||||||
|
|
||||||
// uncached files can't be resized (Inode::SetFileSize() also
|
// uncached files can't be resized (Inode::SetFileSize() also
|
||||||
|
|||||||
Reference in New Issue
Block a user