summaryrefslogtreecommitdiffstats
path: root/sys/fs/tmpfs/tmpfs_subr.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/fs/tmpfs/tmpfs_subr.c')
-rw-r--r--sys/fs/tmpfs/tmpfs_subr.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c
index 84a2038..62dd0bf 100644
--- a/sys/fs/tmpfs/tmpfs_subr.c
+++ b/sys/fs/tmpfs/tmpfs_subr.c
@@ -827,9 +827,10 @@ tmpfs_dir_getdents(struct tmpfs_node *node, struct uio *uio, off_t *cntp)
/* Copy the new dirent structure into the output buffer and
* advance pointers. */
error = uiomove(&d, d.d_reclen, uio);
-
- (*cntp)++;
- de = TAILQ_NEXT(de, td_entries);
+ if (error == 0) {
+ (*cntp)++;
+ de = TAILQ_NEXT(de, td_entries);
+ }
} while (error == 0 && uio->uio_resid > 0 && de != NULL);
/* Update the offset and cache. */
OpenPOWER on IntegriCloud