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:
parent
0774a741c2
commit
3d2f1723fd
@ -365,8 +365,8 @@ Stream<Cache>::ReadAt(off_t pos, uint8 *buffer, size_t *_length)
|
||||
// set/check boundaries for pos/length
|
||||
|
||||
if (pos < 0)
|
||||
pos = 0;
|
||||
else if (pos >= Node()->data.size) {
|
||||
return B_BAD_VALUE;
|
||||
if (pos >= Node()->data.size) {
|
||||
*_length = 0;
|
||||
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
|
||||
if (pos < 0)
|
||||
pos = 0;
|
||||
else if (pos + length > Node()->data.size) {
|
||||
return B_BAD_VALUE;
|
||||
if (pos + length > Node()->data.size) {
|
||||
off_t oldSize = Size();
|
||||
|
||||
// uncached files can't be resized (Inode::SetFileSize() also
|
||||
|
Loading…
Reference in New Issue
Block a user