svn commit: r245793 - head/usr.bin/xinstall
Brooks Davis
brooks at FreeBSD.org
Tue Jan 22 16:23:09 UTC 2013
Author: brooks
Date: Tue Jan 22 16:23:08 2013
New Revision: 245793
URL: http://svnweb.freebsd.org/changeset/base/245793
Log:
Make "install -l s[ar]" act like "ln -sfh" as intended. This fixes
installation of symbolic links where the target is a link is to an
existing directory.
Modified:
head/usr.bin/xinstall/xinstall.c
Modified: head/usr.bin/xinstall/xinstall.c
==============================================================================
--- head/usr.bin/xinstall/xinstall.c Tue Jan 22 15:26:19 2013 (r245792)
+++ head/usr.bin/xinstall/xinstall.c Tue Jan 22 16:23:08 2013 (r245793)
@@ -336,8 +336,21 @@ main(int argc, char *argv[])
/* NOTREACHED */
}
- no_target = stat(to_name = argv[argc - 1], &to_sb);
+ to_name = argv[argc - 1];
+ no_target = stat(to_name, &to_sb);
if (!no_target && S_ISDIR(to_sb.st_mode)) {
+ if (dolink & LN_SYMBOLIC) {
+ if (lstat(to_name, &to_sb) != 0)
+ err(EX_OSERR, "%s vanished", to_name);
+ if (S_ISLNK(to_sb.st_mode)) {
+ if (argc != 2) {
+ errno = ENOTDIR;
+ err(EX_USAGE, "%s", to_name);
+ }
+ install(*argv, to_name, fset, iflags);
+ exit(EX_OK);
+ }
+ }
for (; *argv != to_name; ++argv)
install(*argv, to_name, fset, iflags | DIRECTORY);
exit(EX_OK);
More information about the svn-src-all
mailing list