summaryrefslogtreecommitdiffstats
path: root/lib/libstand/read.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2004-01-21 20:12:23 +0000
committerjhb <jhb@FreeBSD.org>2004-01-21 20:12:23 +0000
commitfffc52fe7a3393e38603b6d028c721e38a1d1cc3 (patch)
treeef59111118b96cb170e58b13a12c868718248613 /lib/libstand/read.c
parentc6b7068a7d44e6082f3cba1e19415d67838013ac (diff)
downloadFreeBSD-src-fffc52fe7a3393e38603b6d028c721e38a1d1cc3.zip
FreeBSD-src-fffc52fe7a3393e38603b6d028c721e38a1d1cc3.tar.gz
Clean up error handling in libstand filesystem code to be more consistent:
- bzipfs and gzipfs now properly return errno values directly from their read routines rather than returning -1. - missing errno values on error returns for the seek routines on almost all filesystems were added. - fstat() now returns -1 if an error occurs rather than ignoring it. - nfs's readdir() routine now reports valid errno values if an error or EOF occurs rather than EPERM (It was just returning 0 for success and 1 for failure). - nullfs used the wrong semantics for every function besides close() and seek(). Getting it right for close() appears to be an accident at that. - read() for buffered files no longer returns 0 (EOF) if an error occurs, but returns -1 instead.
Diffstat (limited to 'lib/libstand/read.c')
-rw-r--r--lib/libstand/read.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libstand/read.c b/lib/libstand/read.c
index 36f0f22..07401c1 100644
--- a/lib/libstand/read.c
+++ b/lib/libstand/read.c
@@ -115,13 +115,13 @@ read(int fd, void *dest, size_t bcount)
if (resid >= SOPEN_RASIZE) {
/* bypass the rest of the request and leave the buffer empty */
if ((errno = (f->f_ops->fo_read)(f, dest, resid, &cresid)))
- return(bcount - resid);
+ return (-1);
return(bcount - cresid);
}
/* fetch more data */
if ((errno = (f->f_ops->fo_read)(f, f->f_rabuf, SOPEN_RASIZE, &cresid)))
- return(bcount - resid); /* behave like fread() */
+ return (-1);
f->f_raoffset = 0;
f->f_ralen = SOPEN_RASIZE - cresid;
/* no more data, return what we had */
OpenPOWER on IntegriCloud