diff options
author | jhb <jhb@FreeBSD.org> | 2004-01-21 20:12:23 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2004-01-21 20:12:23 +0000 |
commit | fffc52fe7a3393e38603b6d028c721e38a1d1cc3 (patch) | |
tree | ef59111118b96cb170e58b13a12c868718248613 /lib/libstand/nfs.c | |
parent | c6b7068a7d44e6082f3cba1e19415d67838013ac (diff) | |
download | FreeBSD-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/nfs.c')
-rw-r--r-- | lib/libstand/nfs.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libstand/nfs.c b/lib/libstand/nfs.c index 82fa08b..1c439a8 100644 --- a/lib/libstand/nfs.c +++ b/lib/libstand/nfs.c @@ -674,6 +674,7 @@ nfs_seek(f, offset, where) d->off = size - offset; break; default: + errno = EINVAL; return (-1); } @@ -741,7 +742,7 @@ nfs_readdir(struct open_file *f, struct dirent *d) buf = rdata.d; roff = (struct nfs_readdir_off *)buf; if (ntohl(roff->cookie) != 0) - return 1; + return EIO; } roff = (struct nfs_readdir_off *)buf; @@ -749,7 +750,7 @@ nfs_readdir(struct open_file *f, struct dirent *d) eof = ntohl((roff+1)->cookie); if (eof) { cookie = 0; - return 1; + return ENOENT; } goto refill; } |