Skip to content

Commit 3164758

Browse files
oech3sylvestre
authored andcommitted
ln -svf /dev/null /tmp/a > /dev/full panics
1 parent e6f9899 commit 3164758

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/uu/ln/src/ln.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// spell-checker:ignore (ToDO) srcpath targetpath EEXIST
77

88
use clap::{Arg, ArgAction, Command};
9+
use std::io::{Write, stdout};
910
use uucore::display::Quotable;
1011
use uucore::error::{FromIo, UError, UResult};
1112
use uucore::fs::{make_path_relative_to, paths_refer_to_same_file};
@@ -455,10 +456,15 @@ fn link(src: &Path, dst: &Path, settings: &Settings) -> UResult<()> {
455456
}
456457

457458
if settings.verbose {
458-
print!("{} -> {}", dst.quote(), source.quote());
459+
let mut out = stdout();
460+
write!(out, "{} -> {}", dst.quote(), source.quote())?;
459461
match backup_path {
460-
Some(path) => println!(" ({})", translate!("ln-backup", "backup" => path.quote())),
461-
None => println!(),
462+
Some(path) => writeln!(
463+
out,
464+
" ({})",
465+
translate!("ln-backup", "backup" => path.quote())
466+
)?,
467+
None => writeln!(out)?,
462468
}
463469
}
464470
Ok(())

0 commit comments

Comments
 (0)