summaryrefslogtreecommitdiff
path: root/src/ln.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ln.c')
-rw-r--r--src/ln.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ln.c b/src/ln.c
index 093b9e6f4..e60cc6e74 100644
--- a/src/ln.c
+++ b/src/ln.c
@@ -174,8 +174,14 @@ do_link (const char *source, const char *dest)
{
if (stat (source, &source_stats) != 0)
{
- error (0, errno, "%s", source);
- return 1;
+ /* This still could be a legitimate request:
+ if SOURCE is a dangling symlink. */
+ if (errno != ENOENT
+ || lstat (source, &source_stats) != 0)
+ {
+ error (0, errno, "%s", source);
+ return 1;
+ }
}
if (!hard_dir_link && S_ISDIR (source_stats.st_mode))
{