Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/uu/sync/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let path = Path::new(&f);
if let Err(e) = open(path, OFlag::O_NONBLOCK, Mode::empty()) {
if e != Errno::EACCES || (e == Errno::EACCES && path.is_dir()) {
return e.map_err_context(|| format!("cannot stat {}", f.quote()))?;
return e.map_err_context(|| format!("error opening {}", f.quote()))?;
}
}
}
Expand All @@ -183,7 +183,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
if !Path::new(&f).exists() {
return Err(USimpleError::new(
1,
format!("cannot stat {}: No such file or directory", f.quote()),
format!("error opening {}: No such file or directory", f.quote()),
));
}
}
Expand Down
6 changes: 3 additions & 3 deletions tests/by-util/test_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fn test_sync_no_existing_files() {
.arg("--data")
.arg("do-no-exist")
.fails()
.stderr_contains("cannot stat");
.stderr_contains("error opening");
}

#[test]
Expand All @@ -63,9 +63,9 @@ fn test_sync_no_permission_dir() {

ts.ccmd("chmod").arg("0").arg(dir).succeeds();
let result = ts.ucmd().arg("--data").arg(dir).fails();
result.stderr_contains("sync: cannot stat 'foo': Permission denied");
result.stderr_contains("sync: error opening 'foo': Permission denied");
let result = ts.ucmd().arg(dir).fails();
result.stderr_contains("sync: cannot stat 'foo': Permission denied");
result.stderr_contains("sync: error opening 'foo': Permission denied");
}

#[cfg(not(target_os = "windows"))]
Expand Down