From 183447a4685bab432b48429b7bccfd69162bd392 Mon Sep 17 00:00:00 2001 From: Simon Schubert Date: Mon, 25 Sep 2006 09:27:21 +0000 Subject: [PATCH] Always warn about identical target and source. Nevertheless, don't treat it as a failure when -f is specified. --- bin/ln/ln.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/ln/ln.c b/bin/ln/ln.c index 410af05516..bace16d316 100644 --- a/bin/ln/ln.c +++ b/bin/ln/ln.c @@ -33,7 +33,7 @@ * @(#) Copyright (c) 1987, 1993, 1994 The Regents of the University of California. All rights reserved. * @(#)ln.c 8.2 (Berkeley) 3/31/94 * $FreeBSD: src/bin/ln/ln.c,v 1.15.2.4 2002/07/12 07:34:38 tjr Exp $ - * $DragonFly: src/bin/ln/ln.c,v 1.10 2006/09/24 21:28:13 corecode Exp $ + * $DragonFly: src/bin/ln/ln.c,v 1.11 2006/09/25 09:27:21 corecode Exp $ */ #include @@ -199,9 +199,8 @@ linkit(const char *target, const char *source, int isdir) /* * If doing hard links and the source (destination) exists and it * actually is the same file like the target (existing file), we - * a) complain that the files are identical, unless - * b) -f is specified, in which case we just accept the job - * as already done. + * complain that the files are identical. If -f is specified, we + * accept the job as already done and return with success. */ if (exists && !sflag) { struct stat tsb; @@ -212,10 +211,11 @@ linkit(const char *target, const char *source, int isdir) } if (tsb.st_dev == sb.st_dev && tsb.st_ino == sb.st_ino) { + warnx("%s and %s are identical (not linked).", target, source); if (fflag) return (0); - warnx("%s and %s are identical (not linked).", target, source); - return (1); + else + return (1); } } /* -- 2.41.0