summaryrefslogtreecommitdiff
path: root/libnetfs
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1995-11-13 21:38:31 +0000
committerMichael I. Bushnell <mib@gnu.org>1995-11-13 21:38:31 +0000
commit22282e0dd9ac99da1ecf65d2240fb5dade64517a (patch)
treea04396213da8143cbda9d88b64870b6616c6ba05 /libnetfs
parentc6f2f50d19ab9049b63975296bb2e1b69ab9a9d2 (diff)
Formerly io-readable.c.~2~
Diffstat (limited to 'libnetfs')
-rw-r--r--libnetfs/io-readable.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libnetfs/io-readable.c b/libnetfs/io-readable.c
index 8169f715..51d04e44 100644
--- a/libnetfs/io-readable.c
+++ b/libnetfs/io-readable.c
@@ -19,6 +19,7 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include "netfs.h"
+#include "io_S.h"
error_t
netfs_S_io_readable (struct protid *user,
@@ -31,7 +32,14 @@ netfs_S_io_readable (struct protid *user,
return EINVAL;
mutex_lock (&user->po->np->lock);
- *amount = user->po->np->nn_stat.st_size - user->po->filepointer;
+ err = netfs_validate_stat (user->po->np, user);
+ if (!err)
+ {
+ if (user->po->np->nn_stat.st_size > user->po->filepointer)
+ *amount = user->po->np->nn_stat.st_size - user->po->filepointer;
+ else
+ *amount = 0;
+ }
mutex_unlock (&user->po->np->lock);
- return 0;
+ return err;
}