Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/puffs/mount_psshfs Save "." attributes in readdir. ...



details:   https://anonhg.NetBSD.org/src/rev/a0e0675460f5
branches:  trunk
changeset: 752156:a0e0675460f5
user:      pooka <pooka%NetBSD.org@localhost>
date:      Wed Feb 17 15:47:36 2010 +0000

description:
Save "." attributes in readdir.  This fixes the root link count
after readdir is called for the root dir the first time (yes,
there's still a window of wrong link count after the fs is mounted.
it's currently quite difficult to call sftp_readdir() from outside
the main loop).

Should fix "find /mnt" problem for a mountpoint with more than the
"guessed" amount of subdirectories, as reported by dyoung.

diffstat:

 usr.sbin/puffs/mount_psshfs/subr.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (33 lines):

diff -r e330d9c1f31f -r a0e0675460f5 usr.sbin/puffs/mount_psshfs/subr.c
--- a/usr.sbin/puffs/mount_psshfs/subr.c        Wed Feb 17 14:32:08 2010 +0000
+++ b/usr.sbin/puffs/mount_psshfs/subr.c        Wed Feb 17 15:47:36 2010 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: subr.c,v 1.48 2010/01/07 21:05:50 pooka Exp $        */
+/*      $NetBSD: subr.c,v 1.49 2010/02/17 15:47:36 pooka Exp $        */
 
 /*
  * Copyright (c) 2006  Antti Kantee.  All Rights Reserved.
@@ -27,7 +27,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: subr.c,v 1.48 2010/01/07 21:05:50 pooka Exp $");
+__RCSID("$NetBSD: subr.c,v 1.49 2010/02/17 15:47:36 pooka Exp $");
 #endif /* !lint */
 
 #include <assert.h>
@@ -344,6 +344,14 @@
                        }
                        free(longname);
                        longname = NULL;
+                       
+                       /*
+                        * In case of DOT, copy the attributes (mostly
+                        * because we want the link count for the root dir).
+                        */
+                       if (strcmp(psn->dir[idx].entryname, ".") == 0) {
+                               setpnva(pu, pn, &psn->dir[idx].va);
+                       }
 
                        /*
                         * Check if we already have a psshfs_dir for the



Home | Main Index | Thread Index | Old Index