Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Jun 2015 23:55:03 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r284881 - head/usr.bin/xinstall
Message-ID:  <201506262355.t5QNt3Ii056998@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Fri Jun 26 23:55:02 2015
New Revision: 284881
URL: https://svnweb.freebsd.org/changeset/base/284881

Log:
  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

Modified:
  head/usr.bin/xinstall/xinstall.c

Modified: head/usr.bin/xinstall/xinstall.c
==============================================================================
--- head/usr.bin/xinstall/xinstall.c	Fri Jun 26 21:35:36 2015	(r284880)
+++ head/usr.bin/xinstall/xinstall.c	Fri Jun 26 23:55:02 2015	(r284881)
@@ -658,6 +658,14 @@ makelink(const char *from_name, const ch
 	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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201506262355.t5QNt3Ii056998>