Module Name: src
Committed By: bouyer
Date: Wed Feb 16 21:20:04 UTC 2011
Modified Files:
src/sys/fs/hfs [netbsd-5]: hfs_vnops.c
Log Message:
Pull up following revision(s) (requested by dholland in ticket #1554):
sys/fs/hfs/hfs_vnops.c: revision 1.21, 1.22 via patch
PR/44523: Taylor R Campbell: mount_hfs badly handles file names with slashes
in them, encode them as colons. XXX: Should encode : as :: too?
remove comments about needing to encode : since the on disk format does
not allow them. Also fix reversed encoding in lookup. From Taylor R Campbell.
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.4.1 src/sys/fs/hfs/hfs_vnops.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/fs/hfs/hfs_vnops.c
diff -u src/sys/fs/hfs/hfs_vnops.c:1.11 src/sys/fs/hfs/hfs_vnops.c:1.11.4.1
--- src/sys/fs/hfs/hfs_vnops.c:1.11 Wed Sep 3 22:57:46 2008
+++ src/sys/fs/hfs/hfs_vnops.c Wed Feb 16 21:20:04 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: hfs_vnops.c,v 1.11 2008/09/03 22:57:46 gmcgarry Exp $ */
+/* $NetBSD: hfs_vnops.c,v 1.11.4.1 2011/02/16 21:20:04 bouyer Exp $ */
/*-
* Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hfs_vnops.c,v 1.11 2008/09/03 22:57:46 gmcgarry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hfs_vnops.c,v 1.11.4.1 2011/02/16 21:20:04 bouyer Exp $");
#ifdef _KERNEL_OPT
#include "opt_ipsec.h"
@@ -398,7 +398,7 @@
*vpp = vdp;
} else {
hfs_callback_args cbargs;
- uint8_t len;
+ uint8_t len, ni;
hfslib_init_cbargs(&cbargs);
@@ -407,6 +407,9 @@
unicn = malloc(cnp->cn_namelen*sizeof(unicn[0]), M_TEMP, M_WAITOK);
len = utf8_to_utf16(unicn, cnp->cn_namelen,
cnp->cn_nameptr, cnp->cn_namelen, 0, NULL);
+ for (ni = 0; ni < len; ni++)
+ if (unicn[ni] == (unichar_t)':')
+ unicn[ni] = (unichar_t)'/';
/* XXX: check conversion errors? */
if (hfslib_make_catalog_key(VTOH(vdp)->h_rec.u.cnid, len, unicn,
&key) == 0) {
@@ -861,7 +864,7 @@
off_t bufoff; /* current position in buffer relative to start of dirents */
uint32_t numchildren;
uint32_t curchild; /* index of child we're currently stuffing into dirent */
- size_t namlen;
+ size_t namlen, ni;
int error;
int i; /* dummy variable */
@@ -906,6 +909,9 @@
/* XXX: how to handle name too long? */
continue;
}
+ for (ni = 0; ni < namlen; ni++)
+ if (curent.d_name[ni] == '/')
+ curent.d_name[ni] = ':';
curent.d_namlen = namlen;
curent.d_reclen = _DIRENT_SIZE(&curent);