summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrmind <rmind@NetBSD.org>2013-11-21 14:39:09 +0000
committerrmind <rmind@NetBSD.org>2013-11-21 14:39:09 +0000
commitca5e306e663dff3e26d4d324df564f669bcbc943 (patch)
tree38d7347cc591a99733479b745ac88ee73b615f8d
parent00f4ef8ee609d922bcf8491b44122acf62c6d3a1 (diff)
tmpfs_dir_getdotents: fix the recent regression, set the correct
d_fileno value for dot-dot. Spotted by Pedro Martelletto, thanks!
-rw-r--r--sys/fs/tmpfs/tmpfs_subr.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c
index bed1d0d4d58..9f495d588e7 100644
--- a/sys/fs/tmpfs/tmpfs_subr.c
+++ b/sys/fs/tmpfs/tmpfs_subr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tmpfs_subr.c,v 1.88 2013/11/18 01:39:34 rmind Exp $ */
+/* $NetBSD: tmpfs_subr.c,v 1.89 2013/11/21 14:39:09 rmind Exp $ */
/*
* Copyright (c) 2005-2013 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.88 2013/11/18 01:39:34 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.89 2013/11/21 14:39:09 rmind Exp $");
#include <sys/param.h>
#include <sys/cprng.h>
@@ -738,15 +738,14 @@ tmpfs_dir_getdotents(tmpfs_node_t *node, struct dirent *dp, struct uio *uio)
off_t next = 0;
int error;
- dp->d_fileno = node->tn_id;
- dp->d_type = DT_DIR;
-
switch (uio->uio_offset) {
case TMPFS_DIRSEQ_DOT:
+ dp->d_fileno = node->tn_id;
strlcpy(dp->d_name, ".", sizeof(dp->d_name));
next = TMPFS_DIRSEQ_DOTDOT;
break;
case TMPFS_DIRSEQ_DOTDOT:
+ dp->d_fileno = node->tn_spec.tn_dir.tn_parent->tn_id;
strlcpy(dp->d_name, "..", sizeof(dp->d_name));
de = TAILQ_FIRST(&node->tn_spec.tn_dir.tn_dir);
next = de ? tmpfs_dir_getseq(node, de) : TMPFS_DIRSEQ_EOF;
@@ -754,6 +753,7 @@ tmpfs_dir_getdotents(tmpfs_node_t *node, struct dirent *dp, struct uio *uio)
default:
KASSERT(false);
}
+ dp->d_type = DT_DIR;
dp->d_namlen = strlen(dp->d_name);
dp->d_reclen = _DIRENT_SIZE(dp);