mirror of
https://github.com/uutils/coreutils.git
synced 2025-12-23 08:47:37 +00:00
ln: Allow hard links to soft links even when they poin to a directory
This commit is contained in:
parent
0a5441fb06
commit
2b8e67bee2
1 changed files with 3 additions and 2 deletions
|
|
@ -434,8 +434,9 @@ fn link(src: &Path, dst: &Path, settings: &Settings) -> UResult<()> {
|
|||
if settings.symbolic {
|
||||
symlink(&source, dst)?;
|
||||
} else {
|
||||
// Cannot create hard link to a directory
|
||||
if src.is_dir() {
|
||||
// Cannot create hard link to a directory directly
|
||||
// We can however create hard link to a symlink that points to a directory, so long as -L is not passed
|
||||
if src.is_dir() && (!src.is_symlink() || settings.logical) {
|
||||
return Err(LnError::FailedToCreateHardLinkDir(source.to_path_buf()).into());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue