Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Make zero length symlinks work on tmpfs.
details: https://anonhg.NetBSD.org/src/rev/586d84c1c580
branches: trunk
changeset: 763732:586d84c1c580
user: hannken <hannken%NetBSD.org@localhost>
date: Fri Apr 01 17:40:54 2011 +0000
description:
Make zero length symlinks work on tmpfs.
Fixes PR #43843 (tmpfs dies with kassert panic for 0 length symlink target)
diffstat:
sys/fs/tmpfs/tmpfs_subr.c | 13 +++++++++----
tests/fs/vfs/t_vnops.c | 6 +-----
2 files changed, 10 insertions(+), 9 deletions(-)
diffs (61 lines):
diff -r d47c72c6d0f5 -r 586d84c1c580 sys/fs/tmpfs/tmpfs_subr.c
--- a/sys/fs/tmpfs/tmpfs_subr.c Fri Apr 01 13:54:00 2011 +0000
+++ b/sys/fs/tmpfs/tmpfs_subr.c Fri Apr 01 17:40:54 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tmpfs_subr.c,v 1.62 2011/01/13 13:35:12 pooka Exp $ */
+/* $NetBSD: tmpfs_subr.c,v 1.63 2011/04/01 17:40:54 hannken Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.62 2011/01/13 13:35:12 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.63 2011/04/01 17:40:54 hannken Exp $");
#include <sys/param.h>
#include <sys/dirent.h>
@@ -163,6 +163,10 @@
case VLNK:
KASSERT(strlen(target) < MAXPATHLEN);
nnode->tn_size = strlen(target);
+ if (nnode->tn_size == 0) {
+ nnode->tn_spec.tn_lnk.tn_link = NULL;
+ break;
+ }
nnode->tn_spec.tn_lnk.tn_link =
tmpfs_strname_alloc(tmp, nnode->tn_size);
if (nnode->tn_spec.tn_lnk.tn_link == NULL) {
@@ -224,8 +228,9 @@
switch (node->tn_type) {
case VLNK:
- tmpfs_strname_free(tmp, node->tn_spec.tn_lnk.tn_link,
- node->tn_size);
+ if (node->tn_size > 0)
+ tmpfs_strname_free(tmp, node->tn_spec.tn_lnk.tn_link,
+ node->tn_size);
break;
case VREG:
/*
diff -r d47c72c6d0f5 -r 586d84c1c580 tests/fs/vfs/t_vnops.c
--- a/tests/fs/vfs/t_vnops.c Fri Apr 01 13:54:00 2011 +0000
+++ b/tests/fs/vfs/t_vnops.c Fri Apr 01 17:40:54 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_vnops.c,v 1.22 2011/03/19 20:05:21 hannken Exp $ */
+/* $NetBSD: t_vnops.c,v 1.23 2011/04/01 17:40:54 hannken Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -527,10 +527,6 @@
RL(rump_sys_chdir(mp));
- if (FSTYPE_TMPFS(tc)) {
- atf_tc_expect_signal(SIGABRT, "PR kern/43843");
- }
-
RL(rump_sys_symlink("", "afile"));
RL(rump_sys_chdir("/"));
}
Home |
Main Index |
Thread Index |
Old Index