Date: Tue, 22 Jan 2013 16:23:08 +0000 (UTC) From: Brooks Davis <brooks@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r245793 - head/usr.bin/xinstall Message-ID: <201301221623.r0MGN8jD027654@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301221623.r0MGN8jD027654>