summaryrefslogtreecommitdiff
path: root/libstore
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2003-08-04 22:00:24 +0000
committerMarcus Brinkmann <marcus@gnu.org>2003-08-04 22:00:24 +0000
commit807622ba0f32ff0f47762e4b9977aba03b912ee3 (patch)
treec88e4fd550506d74630c9933757fba76903514ee /libstore
parent420383e157c616103a6f47bc8192580307a9137a (diff)
2003-07-21 Ognyan Kulev <ogi@mfmi.uni-sofia.bg>
* rdwr.c (store_write): Return EINVAL when LEN is not aligned to STORE->block_size, instead of raising assertion failure. (store_read): Likewise.
Diffstat (limited to 'libstore')
-rw-r--r--libstore/ChangeLog6
-rw-r--r--libstore/rdwr.c12
2 files changed, 11 insertions, 7 deletions
diff --git a/libstore/ChangeLog b/libstore/ChangeLog
index af21782c..0be23c87 100644
--- a/libstore/ChangeLog
+++ b/libstore/ChangeLog
@@ -1,3 +1,9 @@
+2003-07-21 Ognyan Kulev <ogi@mfmi.uni-sofia.bg>
+
+ * rdwr.c (store_write): Return EINVAL when LEN is not aligned to
+ STORE->block_size, instead of raising assertion failure.
+ (store_read): Likewise.
+
2003-08-04 Roland McGrath <roland@frob.com>
* typed.c (store_find_class): Use dlopen/dlclose on the names found by
diff --git a/libstore/rdwr.c b/libstore/rdwr.c
index 354b193a..9737c515 100644
--- a/libstore/rdwr.c
+++ b/libstore/rdwr.c
@@ -1,6 +1,6 @@
/* Store I/O
- Copyright (C) 1995,96,97,98,99,2001,02 Free Software Foundation, Inc.
+ Copyright (C) 1995-1999,2001,2002,2003 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.org>
This file is part of the GNU Hurd.
@@ -89,8 +89,6 @@ store_next_run (struct store *store, struct store_run *runs_end,
return 1;
}
-#include <assert.h>
-
/* Write LEN bytes from BUF to STORE at ADDR. Returns the amount written
in AMOUNT. ADDR is in BLOCKS (as defined by STORE->block_size). */
error_t
@@ -110,8 +108,8 @@ store_write (struct store *store,
if ((addr << block_shift) + len > store->size)
return EIO;
- if (store->block_size != 0)
- assert ((len & (store->block_size - 1)) == 0);
+ if (store->block_size != 0 && (len & (store->block_size - 1)) != 0)
+ return EINVAL;
addr = store_find_first_run (store, addr, &run, &runs_end, &base, &index);
if (addr < 0)
@@ -190,8 +188,8 @@ store_read (struct store *store,
if ((addr << block_shift) + amount > store->size)
amount = store->size - (addr << block_shift);
- if (store->block_size != 0)
- assert ((amount & (store->block_size - 1)) == 0);
+ if (store->block_size != 0 && (amount & (store->block_size - 1)) != 0)
+ return EINVAL;
if ((amount >> block_shift) <= run->length - addr)
/* The first run has it all... */