Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/fs/v7fs Fix return vaule. Pass t_vnops:rename_dotdot, di...
details: https://anonhg.NetBSD.org/src/rev/0fd20f574170
branches: trunk
changeset: 767769:0fd20f574170
user: uch <uch%NetBSD.org@localhost>
date: Sat Jul 30 03:51:53 2011 +0000
description:
Fix return vaule. Pass t_vnops:rename_dotdot, dir_noempty, rename_dir(6)
diffstat:
sys/fs/v7fs/v7fs_file.c | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diffs (46 lines):
diff -r 68a1a553aa2e -r 0fd20f574170 sys/fs/v7fs/v7fs_file.c
--- a/sys/fs/v7fs/v7fs_file.c Sat Jul 30 03:43:20 2011 +0000
+++ b/sys/fs/v7fs/v7fs_file.c Sat Jul 30 03:51:53 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: v7fs_file.c,v 1.2 2011/07/18 21:51:49 apb Exp $ */
+/* $NetBSD: v7fs_file.c,v 1.3 2011/07/30 03:51:53 uch Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
#endif
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: v7fs_file.c,v 1.2 2011/07/18 21:51:49 apb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: v7fs_file.c,v 1.3 2011/07/30 03:51:53 uch Exp $");
#if defined _KERNEL_OPT
#include "opt_v7fs.h"
#endif
@@ -247,16 +247,24 @@
return error;
if (v7fs_inode_isdir(&inode)) {
- /* Check child directory exists. */
+ char filename[V7FS_NAME_MAX + 1];
+ v7fs_dirent_filename(filename, name);
+ /* Check parent */
+ if (strncmp(filename, "..", V7FS_NAME_MAX) == 0) {
+ DPRINTF("can not remove '..'\n");
+ return EINVAL; /* t_vnops rename_dotdot */
+ }
+ /* Check empty */
if (v7fs_inode_filesize(&inode) !=
sizeof(struct v7fs_dirent) * 2 /*"." + ".."*/) {
- DPRINTF("file exists.\n");
- return EEXIST;
+ DPRINTF("directory not empty.\n");
+ return ENOTEMPTY;/* t_vnops dir_noempty, rename_dir(6)*/
}
inode.nlink = 0; /* remove this. */
} else {
/* Decrement reference count. */
--inode.nlink; /* regular file. */
+ DPRINTF("%s nlink=%d\n", name, inode.nlink);
}
Home |
Main Index |
Thread Index |
Old Index