From 653ee19c65eeda001b3af4bfe5b15888fc124933 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 11 Nov 2014 07:00:18 -0600 Subject: [PATCH] Check link target - do nothing if link is already created and the target matches the request. From Freddie Chopin. --- nuttx/tools/link.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nuttx/tools/link.sh b/nuttx/tools/link.sh index da1e6e7ae..f14e9e5ab 100755 --- a/nuttx/tools/link.sh +++ b/nuttx/tools/link.sh @@ -51,6 +51,15 @@ fi # report that it does not exist. if [ -h "${dest}" ]; then + + # If the link is already created (and matches the request) do nothing + + if [ "$(readlink ${dest})" = "${src}" ]; then + exit 0 + fi + + # Otherwise, remove the link + rm -f "${dest}" else