summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1999-07-11 19:42:13 +0000
committerRoland McGrath <roland@gnu.org>1999-07-11 19:42:13 +0000
commit914934d7e9e4223b3d1131053ad4dcb965e95ada (patch)
tree1946d4766acefecabd8752acd82c1b29c8dc1114
parent94810418f8387c85769d132827e9937e4b1d0238 (diff)
1999-07-11 Roland McGrath <roland@baalperazim.frob.com>
* dev.c (dev_read: ensure_buf): Fix sloppy bugs in last change.
-rw-r--r--storeio/dev.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/storeio/dev.c b/storeio/dev.c
index 4c7b63da..cf557f46 100644
--- a/storeio/dev.c
+++ b/storeio/dev.c
@@ -154,7 +154,7 @@ dev_open (struct store_parsed *name, int flags, int inhibit_cache,
return err;
}
- new->buf = mmap (0, new->store->block_size, PROT_READ|PROT_WRITE,
+ new->buf = mmap (0, new->store->block_size, PROT_READ|PROT_WRITE,
MAP_ANON, 0, 0);
if (new->buf == (void *) -1)
{
@@ -371,17 +371,16 @@ dev_read (struct dev *dev, off_t offs, size_t whole_amount,
int allocated_buf = 0;
error_t ensure_buf ()
{
- error_t err;
if (*len < whole_amount)
{
- *buf = mmap (0, whole_amount, PROT_READ|PROT_WRITE,
- MAP_ANON, 0, 0);
- if (*buf != (void *) -1)
- allocated_buf = 1;
+ void *new = mmap (0, whole_amount, PROT_READ|PROT_WRITE,
+ MAP_ANON, 0, 0);
+ if (new == (void *) -1)
+ return errno;
+ *buf = new;
+ allocated_buf = 1;
}
- else
- err = 0;
- return err;
+ return 0;
}
error_t buf_read (size_t buf_offs, size_t io_offs, size_t len)
{