aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>1994-12-06 18:50:44 +0000
committerBruce Evans <bde@FreeBSD.org>1994-12-06 18:50:44 +0000
commit9195f409828d968400c7f85df92fe418a9b22299 (patch)
treebebd56940232b19a97e129fd6998f7c88c36a0bd /bin
parentb22bafcacc5711f03dd7db82fa6f83ef4ba23236 (diff)
downloadsrc-9195f409828d968400c7f85df92fe418a9b22299.tar.gz
src-9195f409828d968400c7f85df92fe418a9b22299.zip
Use lstat() instead of stat() for checking if the final source file exists,
so that `ln -fs' works when the source is a symlink pointing to a non- existent file.
Notes
Notes: svn path=/head/; revision=5002
Diffstat (limited to 'bin')
-rw-r--r--bin/ln/ln.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/ln/ln.c b/bin/ln/ln.c
index 71c1a57ed084..73fffa711856 100644
--- a/bin/ln/ln.c
+++ b/bin/ln/ln.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: ln.c,v 1.4 1994/09/24 02:55:48 davidg Exp $
*/
#ifndef lint
@@ -142,9 +142,9 @@ linkit(target, source, isdir)
++p;
(void)snprintf(path, sizeof(path), "%s/%s", source, p);
source = path;
- exists = !stat(source, &sb);
+ exists = !lstat(source, &sb);
} else
- exists = !stat(source, &sb);
+ exists = !lstat(source, &sb);
/*
* If the file exists, and -f was specified, unlink it.