svn commit: r245198 - projects/mtree/usr.bin/xinstall

Brooks Davis brooks at FreeBSD.org
Wed Jan 9 00:22:54 UTC 2013


Author: brooks
Date: Wed Jan  9 00:22:53 2013
New Revision: 245198
URL: http://svnweb.freebsd.org/changeset/base/245198

Log:
  When we're making symbolic links and the target is a broken symlink then
  unlink it rather than trying to link through it since that doesn't work.

Modified:
  projects/mtree/usr.bin/xinstall/xinstall.c

Modified: projects/mtree/usr.bin/xinstall/xinstall.c
==============================================================================
--- projects/mtree/usr.bin/xinstall/xinstall.c	Wed Jan  9 00:01:26 2013	(r245197)
+++ projects/mtree/usr.bin/xinstall/xinstall.c	Wed Jan  9 00:22:53 2013	(r245198)
@@ -726,7 +726,9 @@ install(const char *from_name, const cha
 		devnull = 1;
 	}
 
-	target = stat(to_name, &to_sb) == 0;
+	target = (stat(to_name, &to_sb) == 0);
+	if (!target && dolink & LN_SYMBOLIC && errno == ELOOP)
+		target = (lstat(to_name, &to_sb) == 0);
 
 	if (dolink) {
 		if (target) {


More information about the svn-src-projects mailing list