summaryrefslogtreecommitdiff
path: root/libdiskfs
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1995-11-13 21:28:23 +0000
committerMichael I. Bushnell <mib@gnu.org>1995-11-13 21:28:23 +0000
commit3fd0286bd2761864cf3ee39da705fdb50f06dedf (patch)
tree4d0f09ca84bb99f315838758b43d9d4ea2d1ba4e /libdiskfs
parent275ead4b88aae34642eba6f6e37cbdfed61e47d8 (diff)
(diskfs_S_io_readable): Set *AMOUNT to zero if filepointer is past the
end of the file.
Diffstat (limited to 'libdiskfs')
-rw-r--r--libdiskfs/io-readable.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libdiskfs/io-readable.c b/libdiskfs/io-readable.c
index 3bb93879..1d9dd573 100644
--- a/libdiskfs/io-readable.c
+++ b/libdiskfs/io-readable.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1994 Free Software Foundation
+ Copyright (C) 1994, 1995 Free Software Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -36,7 +36,10 @@ diskfs_S_io_readable (struct protid *cred,
mutex_lock (&np->lock);
ioserver_get_conch (&np->conch);
- *amount = np->dn_stat.st_size - cred->po->filepointer;
+ if (np->dn_stat.st_size > cred->po->filepointer)
+ *amount = np->dn_stat.st_size - cred->po->filepointer;
+ else
+ *amount = 0;
mutex_unlock (&np->lock);
return 0;