* the BeBook documents WriteAt() and Write() to differ analogous to
ReadAt() and Read() with regards to the file position. Ie, WriteAt() is not supposed to modify the data pointer. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23830 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
835b8e688a
commit
40da55c3ad
@ -398,7 +398,13 @@ BFile::WriteAt(off_t location, const void *buffer, size_t size)
|
|||||||
return InitCheck();
|
return InitCheck();
|
||||||
if (location < 0)
|
if (location < 0)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
return _kern_write(get_fd(), location, buffer, size);
|
|
||||||
|
// WriteAt() is not supposed to move the current position on the file.
|
||||||
|
off_t curPos = Position(); // Cache current position.
|
||||||
|
ssize_t result = _kern_write(get_fd(), location, buffer, size);
|
||||||
|
Seek(curPos, SEEK_SET); // Resets file position.
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Seek
|
// Seek
|
||||||
|
Loading…
Reference in New Issue
Block a user