Set the permissions on restored symbolic links.

PR:		bin/37665
Submitted by:	"Michael C. Adler" <mad1@tapil.com>
This commit is contained in:
Ian Dowse 2002-05-02 17:39:19 +00:00
parent bc91c5107a
commit 915a1dab22

View File

@ -565,6 +565,14 @@ extractfile(char *name)
return (genliteraldir(name, curfile.ino));
case IFLNK:
{
uid_t uid;
gid_t gid;
int ret;
uid = curfile.dip->di_uid;
gid = curfile.dip->di_gid;
lnkbuf[0] = '\0';
pathlen = 0;
getfile(xtrlnkfile, xtrlnkskip);
@ -573,7 +581,17 @@ extractfile(char *name)
"%s: zero length symbolic link (ignored)\n", name);
return (GOOD);
}
return (linkit(lnkbuf, name, SYMLINK));
ret = linkit(lnkbuf, name, SYMLINK);
if (ret == GOOD) {
if (lchown(name, uid, gid))
perror(name);
if (lchmod(name, mode))
perror(name);
lutimes(name, timep);
}
/* symbolic link doesn't have any flags */
return (ret);
}
case IFIFO:
vprintf(stdout, "extract fifo %s\n", name);