svn commit: r320172 - head/bin/ln

Bryan Drewery bdrewery at FreeBSD.org
Wed Jun 21 17:13:01 UTC 2017


On 6/20/2017 1:46 PM, Ngie Cooper wrote:
> Author: ngie
> Date: Tue Jun 20 20:46:08 2017
> New Revision: 320172
> URL: https://svnweb.freebsd.org/changeset/base/320172
> 
> Log:
>   ln(1): fix -F behavior
>   
>   When '-F' option is used, the target directory needs to be unlinked.
>   Currently, the modified target ("target/source") is being unlinked, and
>   since it doesn't yet exist, the original target isn't removed.
>   This is fixed by skipping the block where target is modified to
>   "target/source" when '-F' option is set.
>   Hence, a symbolic link (with the same name as of the original target) to
>   the source_file is produced.
>   
=====>   Update the test for ln(1) to reflect fix for option '-F'

I don't see a test update here.

>   
>   MFC after:	1 month
>   PR:		219943
>   Differential Revision:	D11167
>   Submitted by:	shivansh
>   Sponsored by:	Google (GSoC 2017)
> 
> Modified:
>   head/bin/ln/ln.c
> 
> Modified: head/bin/ln/ln.c
> ==============================================================================
> --- head/bin/ln/ln.c	Tue Jun 20 20:34:30 2017	(r320171)
> +++ head/bin/ln/ln.c	Tue Jun 20 20:46:08 2017	(r320172)
> @@ -245,11 +245,11 @@ linkit(const char *source, const char *target, int isd
>  
>  	/*
>  	 * If the target is a directory (and not a symlink if hflag),
> -	 * append the source's name.
> +	 * append the source's name, unless Fflag is set.
>  	 */
> -	if (isdir ||
> +	if (!Fflag && (isdir ||
>  	    (lstat(target, &sb) == 0 && S_ISDIR(sb.st_mode)) ||
> -	    (!hflag && stat(target, &sb) == 0 && S_ISDIR(sb.st_mode))) {
> +	    (!hflag && stat(target, &sb) == 0 && S_ISDIR(sb.st_mode)))) {
>  		if (strlcpy(bbuf, source, sizeof(bbuf)) >= sizeof(bbuf) ||
>  		    (p = basename(bbuf)) == NULL ||
>  		    snprintf(path, sizeof(path), "%s/%s", target, p) >=
> 


-- 
Regards,
Bryan Drewery

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/svn-src-all/attachments/20170621/64547022/attachment.sig>


More information about the svn-src-all mailing list