From 3fd0286bd2761864cf3ee39da705fdb50f06dedf Mon Sep 17 00:00:00 2001 From: "Michael I. Bushnell" Date: Mon, 13 Nov 1995 21:28:23 +0000 Subject: (diskfs_S_io_readable): Set *AMOUNT to zero if filepointer is past the end of the file. --- libdiskfs/io-readable.c | 7 +++++-- 1 file 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; -- cgit v1.2.3