summaryrefslogtreecommitdiff
path: root/libdiskfs
diff options
context:
space:
mode:
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;