diff options
author | Jim Meyering <jim@meyering.net> | 1999-01-31 18:41:36 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1999-01-31 18:41:36 +0000 |
commit | 4872440d7a09f770322b9691dc8313833f37d330 (patch) | |
tree | 45dbfe67d56e2f840ce2b69c2526c57388bf4835 /src | |
parent | 821fddfdc509e02ba333f9a097e12bc42e4049ed (diff) | |
download | coreutils-4872440d7a09f770322b9691dc8313833f37d330.tar.xz |
(do_link): Allow creation of a hard link to a dangling
symlink. Reported by Alexey Solovyov:
Diffstat (limited to 'src')
-rw-r--r-- | src/ln.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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)) { |