From 3f471a638f28e497da02569815b07d114769881b Mon Sep 17 00:00:00 2001 From: kre Date: Sat, 22 Apr 2017 12:22:31 +0000 Subject: [PATCH] When called as "link" (not currently installed that way) always simply do a link(2) sys call, never use the internal linkit() routine, which allows for a destination directory and installs the link inside (and more.) This makes ln's "link" variant comply with its (currently commented out) section if its manual page, and also makes it identical to /usr/sbin/link. --- bin/ln/ln.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/ln/ln.c b/bin/ln/ln.c index f283b9ee53a3..2f7e8549f258 100644 --- a/bin/ln/ln.c +++ b/bin/ln/ln.c @@ -1,4 +1,4 @@ -/* $NetBSD: ln.c,v 1.38 2017/04/21 14:46:31 szptvlfn Exp $ */ +/* $NetBSD: ln.c,v 1.39 2017/04/22 12:22:31 kre Exp $ */ /*- * Copyright (c) 1987, 1993, 1994 @@ -44,7 +44,7 @@ static char sccsid[] = "@(#)ln.c 8.2 (Berkeley) 3/31/94"; #ifdef __FBSDID __FBSDID("$FreeBSD: head/bin/ln/ln.c 251261 2013-06-02 17:55:00Z eadler $"); #endif -__RCSID("$NetBSD: ln.c,v 1.38 2017/04/21 14:46:31 szptvlfn Exp $"); +__RCSID("$NetBSD: ln.c,v 1.39 2017/04/22 12:22:31 kre Exp $"); #include #include @@ -96,7 +96,9 @@ main(int argc, char *argv[]) argv += optind; if (argc != 2) usage(); - exit(linkit(argv[0], argv[1], 0)); + if (link(argv[0], argv[1]) == -1) + err(EXIT_FAILURE, NULL); + exit(EXIT_SUCCESS); } while ((ch = getopt(argc, argv, "FLPfhinsvw")) != -1)