From 4bd4925bd237b09e48fafa7c69c37130ed34a8f7 Mon Sep 17 00:00:00 2001 From: bde Date: Tue, 6 Dec 1994 18:50:44 +0000 Subject: 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. --- bin/ln/ln.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/ln/ln.c b/bin/ln/ln.c index 71c1a57..73fffa7 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. -- cgit v1.1