Mercurial > illumos > illumos-gate
changeset 9031:569640c630f9
6807009 Some symlinks in the solaris.zlib have missing '/' characters in the link target
Contributed by Juergen Keil <jrgn.keil@googlemail.com>
author | batschul <Frank.Batschulat@Sun.COM> |
---|---|
date | Fri, 13 Mar 2009 11:21:18 -0600 |
parents | 243fd360d81f |
children | 4e1742ecfd43 |
files | usr/src/uts/common/fs/hsfs/hsfs_rrip.c |
diffstat | 1 files changed, 9 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/common/fs/hsfs/hsfs_rrip.c Fri Mar 13 08:25:47 2009 -0600 +++ b/usr/src/uts/common/fs/hsfs/hsfs_rrip.c Fri Mar 13 11:21:18 2009 -0600 @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Rock Ridge extensions to the System Use Sharing protocol * for the High Sierra filesystem @@ -220,7 +218,7 @@ size_t len; if (IS_NAME_BIT_SET(rrip_flags, RRIP_NAME_ROOT)) - (void) strcpy((char *)dst, "/"); + dst[0] = 0; if (IS_NAME_BIT_SET(rrip_flags, RRIP_NAME_CURRENT)) { SUA_string = (uchar_t *)"."; @@ -379,14 +377,11 @@ MAXPATHLEN); /* - * If the component is continued, Don't put a - * '/' in the pathname, but do NULL terminate it. - * And avoid 2 '//' in a row, or if '/' was wanted + * If the component is continued don't put a '/' in + * the pathname, but do NULL terminate it. */ if (IS_NAME_BIT_SET(RRIP_COMP_FLAGS(comp_ptr), - RRIP_NAME_CONTINUE) || - (sym_link[sym_link_len - 1] == '/')) { - + RRIP_NAME_CONTINUE)) { sym_link[sym_link_len] = '\0'; } else { sym_link[sym_link_len] = '/'; @@ -399,9 +394,11 @@ } /* - * take out the last slash + * If we reached the end of the symbolic link, take out the + * last slash, but don't change ROOT "/" to an empty string. */ - if (sym_link[sym_link_len - 1] == '/') + if (!IS_NAME_BIT_SET(RRIP_SL_FLAGS(sl_ptr), RRIP_NAME_CONTINUE) && + sym_link_len > 1 && sym_link[sym_link_len - 1] == '/') sym_link[--sym_link_len] = '\0'; /*