aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/xinstall
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-06-26 23:55:02 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-06-26 23:55:02 +0000
commit9ebcef9a748a8de8d0d8046de8ac2f368749ebed (patch)
tree525e9d8a9199addd5585498b46c50fcb5e84a5f4 /usr.bin/xinstall
parent4b1222a215dbbfd7fdaaabecd04535459396f404 (diff)
short circuit install -l rs
When requesting install(1) to only make relative symlinks, by pass all the done to actually compute the relative symlink if the path given in argument is already a relative path
Notes
Notes: svn path=/head/; revision=284881
Diffstat (limited to 'usr.bin/xinstall')
-rw-r--r--usr.bin/xinstall/xinstall.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c
index b59db70bf99d..33e818a907ee 100644
--- a/usr.bin/xinstall/xinstall.c
+++ b/usr.bin/xinstall/xinstall.c
@@ -658,6 +658,14 @@ makelink(const char *from_name, const char *to_name,
if (dolink & LN_RELATIVE) {
char *cp, *d, *s;
+ if (*from_name != '/') {
+ /* this is already a relative link */
+ do_symlink(from_name, to_name, target_sb);
+ /* XXX: from_name may point outside of destdir. */
+ metadata_log(to_name, "link", NULL, from_name, NULL, 0);
+ return;
+ }
+
/* Resolve pathnames. */
if (realpath(from_name, src) == NULL)
err(EX_OSERR, "%s: realpath", from_name);