svn commit: r284881 - head/usr.bin/xinstall

Baptiste Daroussin bapt at FreeBSD.org
Fri Jun 26 23:55:03 UTC 2015


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);


More information about the svn-src-head mailing list