Mercurial > illumos > illumos-gate
changeset 3805:8ef866880810
6205524 Using /sbin/tar -h on Solaris9 - symlinked files become normal files
author | lovely |
---|---|
date | Mon, 12 Mar 2007 17:29:09 -0700 |
parents | 513de1daa569 |
children | 38a133f54518 |
files | usr/src/cmd/tar/tar.c |
diffstat | 1 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/tar/tar.c Mon Mar 12 14:09:35 2007 -0700 +++ b/usr/src/cmd/tar/tar.c Mon Mar 12 17:29:09 2007 -0700 @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -396,7 +396,7 @@ static void closevol(void); static void copy(void *dst, void *src); static int convtoreg(off_t); -static void delete_target(int fd, char *namep); +static void delete_target(int fd, char *comp, char *namep); static void doDirTimes(char *name, timestruc_t modTime); static void done(int n); static void dorep(char *argv[]); @@ -2906,7 +2906,7 @@ } if (dblock.dbuf.typeflag == '0' || dblock.dbuf.typeflag == NULL || convflag) { - delete_target(dirfd, comp); + delete_target(dirfd, comp, namep); linkp = templink; if (*linkp != NULL) { if (Aflag && *linkp == '/') @@ -5621,20 +5621,20 @@ */ static void -delete_target(int fd, char *namep) +delete_target(int fd, char *comp, char *namep) { struct stat xtractbuf; char buf[PATH_MAX + 1]; int n; - if (unlinkat(fd, namep, AT_REMOVEDIR) < 0) { + if (unlinkat(fd, comp, AT_REMOVEDIR) < 0) { if (errno == ENOTDIR && !hflag) { - (void) unlinkat(fd, namep, 0); + (void) unlinkat(fd, comp, 0); } else if (errno == ENOTDIR && hflag) { if (!lstat(namep, &xtractbuf)) { if ((xtractbuf.st_mode & S_IFMT) != S_IFLNK) { - (void) unlinkat(fd, namep, 0); + (void) unlinkat(fd, comp, 0); } else if ((n = readlink(namep, buf, PATH_MAX)) != -1) { buf[n] = (char)NULL; @@ -5643,10 +5643,10 @@ if (errno == ENOTDIR) (void) unlinkat(fd, buf, 0); } else { - (void) unlinkat(fd, namep, 0); + (void) unlinkat(fd, comp, 0); } } else { - (void) unlinkat(fd, namep, 0); + (void) unlinkat(fd, comp, 0); } } }