From 3d2f1723fd8c0b84fb6b79f4931e5aa0571d6136 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 12 Sep 2003 07:21:03 +0000 Subject: [PATCH] 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 --- src/add-ons/kernel/file_systems/bfs/Stream.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/add-ons/kernel/file_systems/bfs/Stream.h b/src/add-ons/kernel/file_systems/bfs/Stream.h index e4f42c54d2..e97008ff73 100644 --- a/src/add-ons/kernel/file_systems/bfs/Stream.h +++ b/src/add-ons/kernel/file_systems/bfs/Stream.h @@ -365,8 +365,8 @@ Stream::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::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