summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-03-11 07:39:15 +0000
committerRoland McGrath <roland@gnu.org>2002-03-11 07:39:15 +0000
commit339af39daba3e7230c001c432d7753b3073dfda9 (patch)
tree0eeefd3bad80f340b9e113e17d3e69d1dcfe8724
parentc979c4a3b0dcd806eaf8730b56faeb9807a7c937 (diff)
2002-03-10 Roland McGrath <roland@frob.com>
* dev.c (dev_read): Return success with *LEN = 0 when reading exactly at the end of the store.
-rw-r--r--storeio/dev.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/storeio/dev.c b/storeio/dev.c
index f82200e8..9a9694b2 100644
--- a/storeio/dev.c
+++ b/storeio/dev.c
@@ -1,6 +1,6 @@
/* store `device' I/O
- Copyright (C) 1995,96,98,99,2000,2001 Free Software Foundation, Inc.
+ Copyright (C) 1995,96,98,99,2000,01,02 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.org>
This program is free software; you can redistribute it and/or
@@ -433,6 +433,13 @@ dev_read (struct dev *dev, off_t offs, size_t whole_amount,
}
}
+ if (dev->store->size > 0 && offs == dev->store->size)
+ {
+ /* Reading end of file. */
+ *len = 0;
+ return 0;
+ }
+
if (dev->inhibit_cache)
{
/* Under --no-cache, we permit only whole-block reads.