diff options
author | iedowse <iedowse@FreeBSD.org> | 2002-05-02 17:39:19 +0000 |
---|---|---|
committer | iedowse <iedowse@FreeBSD.org> | 2002-05-02 17:39:19 +0000 |
commit | cfc2da8a90d0bd4a994e44f151711c2a2431ba62 (patch) | |
tree | 6734bef389d98d8cad55805c0fbe980e4928059d /sbin/restore | |
parent | e8eb438f940e239d8305d20b01b85876ff8506b5 (diff) | |
download | FreeBSD-src-cfc2da8a90d0bd4a994e44f151711c2a2431ba62.zip FreeBSD-src-cfc2da8a90d0bd4a994e44f151711c2a2431ba62.tar.gz |
Set the permissions on restored symbolic links.
PR: bin/37665
Submitted by: "Michael C. Adler" <mad1@tapil.com>
Diffstat (limited to 'sbin/restore')
-rw-r--r-- | sbin/restore/tape.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/sbin/restore/tape.c b/sbin/restore/tape.c index 7b6f62c..a8ae8f3 100644 --- a/sbin/restore/tape.c +++ b/sbin/restore/tape.c @@ -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); |