From owner-svn-src-head@FreeBSD.ORG Tue Jan 22 16:23:09 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 018419E6; Tue, 22 Jan 2013 16:23:09 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E7CB3F4; Tue, 22 Jan 2013 16:23:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0MGN8JF027655; Tue, 22 Jan 2013 16:23:08 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0MGN8jD027654; Tue, 22 Jan 2013 16:23:08 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201301221623.r0MGN8jD027654@svn.freebsd.org> From: Brooks Davis Date: Tue, 22 Jan 2013 16:23:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r245793 - head/usr.bin/xinstall X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jan 2013 16:23:09 -0000 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);