git » libjio » commit e6cf3c1

In jread(), if we do a partial reading, we need to advance the file pointer. It's an awful bug, strangely jwrite() and jwritev() are OK, so I must have missed it.

author Alberto Bertogli
2004-08-30 04:30:43 UTC
committer Alberto Bertogli
2007-07-15 13:17:52 UTC
parent 048f1aee59027e61aed194f8dcdd8e5c046396cb

In jread(), if we do a partial reading, we need to advance the file pointer. It's an awful bug, strangely jwrite() and jwritev() are OK, so I must have missed it.

In jread(), if we do a partial reading, we need to advance the file pointer.
It's an awful bug, strangely jwrite() and jwritev() are OK, so I must have
missed it.

unix.c +1 -1

diff --git a/unix.c b/unix.c
index 03bd9b6..f0ee5b1 100644
--- a/unix.c
+++ b/unix.c
@@ -31,7 +31,7 @@ ssize_t jread(struct jfs *fs, void *buf, size_t count)
 	rv = spread(fs->fd, buf, count, pos);
 	plockf(fs->fd, F_UNLOCK, pos, count);
 
-	if (rv == count) {
+	if (rv >= 0) {
 		/* if success, advance the file pointer */
 		lseek(fs->fd, count, SEEK_CUR);
 	}