summaryrefslogtreecommitdiff
path: root/libdiskfs
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1995-05-12 19:45:39 +0000
committerMichael I. Bushnell <mib@gnu.org>1995-05-12 19:45:39 +0000
commit7492e8036ced3ac9ecd2ec54ec0e8ea2daa5d3fb (patch)
tree38435adc8fc67d4ba2e6ba298c327b3fc4dac0f1 /libdiskfs
parent5b5423bbdfb512c5cca05e3a6a1ec87c1b218aa5 (diff)
(diskfs_S_io_read): If the offset is past the end of the file, then
return EOF.
Diffstat (limited to 'libdiskfs')
-rw-r--r--libdiskfs/io-read.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libdiskfs/io-read.c b/libdiskfs/io-read.c
index 9c7a5259..a25f3801 100644
--- a/libdiskfs/io-read.c
+++ b/libdiskfs/io-read.c
@@ -47,7 +47,9 @@ diskfs_S_io_read (struct protid *cred,
if (off == -1)
off = cred->po->filepointer;
- if (off + maxread > np->dn_stat.st_size)
+ if (off > np->dn_stat.st_size)
+ maxread = 0;
+ else if (off + maxread > np->dn_stat.st_size)
maxread = np->dn_stat.st_size - off;
if (maxread > *datalen)