From fba1ada51bdfa7fea872c2f6a0e8745584df22c0 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Thu, 14 Mar 2002 01:23:08 +0000 Subject: 2002-03-14 Marcus Brinkmann * rdwr.c (store_read): Truncate amount to be read to size of store. Use memcpy rather than bcopy. (store_write): Return EIO if caller tries to write over the end of the store. * copy.c (copy_read): Do not multiply LEN returned from vm_read with vm_page_size. --- libstore/copy.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'libstore/copy.c') diff --git a/libstore/copy.c b/libstore/copy.c index a984fbd2..4e1cf0d4 100644 --- a/libstore/copy.c +++ b/libstore/copy.c @@ -1,6 +1,6 @@ /* Copy store backend - Copyright (C) 1995,96,97,99,2000,01 Free Software Foundation, Inc. + Copyright (C) 1995,96,97,99,2000,01,02 Free Software Foundation, Inc. Written by Miles Bader This file is part of the GNU Hurd. @@ -36,14 +36,10 @@ copy_read (struct store *store, store_offset_t addr, size_t index, char *data = store->hook + (addr * store->block_size); if (page_aligned (data) && page_aligned (amount)) - { - /* When reading whole pages, we can avoid any real copying. */ - error_t err = vm_read (mach_task_self (), - (vm_address_t) data, amount, - (pointer_t *) buf, len); - *len *= vm_page_size; - return err; - } + /* When reading whole pages, we can avoid any real copying. */ + return vm_read (mach_task_self (), + (vm_address_t) data, amount, + (pointer_t *) buf, len); if (*len < amount) /* Have to allocate memory for the return value. */ -- cgit v1.2.3