Source-Changes-HG archive

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

[src/trunk]: src/tests/fs/puffs/h_dtfs check we don't rename onto a non-empty...



details:   https://anonhg.NetBSD.org/src/rev/20b63e9e3722
branches:  trunk
changeset: 756364:20b63e9e3722
user:      pooka <pooka%NetBSD.org@localhost>
date:      Wed Jul 14 14:22:15 2010 +0000

description:
check we don't rename onto a non-empty directory

diffstat:

 tests/fs/puffs/h_dtfs/dtfs_vnops.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 4f0933266c6f -r 20b63e9e3722 tests/fs/puffs/h_dtfs/dtfs_vnops.c
--- a/tests/fs/puffs/h_dtfs/dtfs_vnops.c        Wed Jul 14 14:07:37 2010 +0000
+++ b/tests/fs/puffs/h_dtfs/dtfs_vnops.c        Wed Jul 14 14:22:15 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dtfs_vnops.c,v 1.2 2010/07/14 13:09:52 pooka Exp $     */
+/*     $NetBSD: dtfs_vnops.c,v 1.3 2010/07/14 14:22:15 pooka Exp $     */
 
 /*
  * Copyright (c) 2006  Antti Kantee.  All Rights Reserved.
@@ -304,6 +304,7 @@
        const struct puffs_cn *pcn_targ)
 {
        struct dtfs_dirent *dfd_src;
+       struct dtfs_file *df_targ;
        struct puffs_node *pn_sdir = opc;
        struct puffs_node *pn_sfile = src;
        struct puffs_node *pn_tdir = targ_dir;
@@ -325,7 +326,9 @@
        /* if there's a target file, nuke it for atomic replacement */
        if (pn_tfile) {
                if (pn_tfile->pn_va.va_type == VDIR) {
-                       assert(/*CONSTCOND*/0); /* XXX FIXME */
+                       df_targ = DTFS_CTOF(pn_tfile);
+                       if (!LIST_EMPTY(&df_targ->df_dirents))
+                               return ENOTEMPTY;
                }
                dtfs_nukenode(pn_tfile, pn_sdir,
                    pcn_targ->pcn_name, pcn_targ->pcn_namelen);



Home | Main Index | Thread Index | Old Index