Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

comm: generate an error if the input is a directory #6853

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sylvestre
Copy link
Contributor

tested by tests/misc/read-errors

Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/rm/rm1 (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

Comment on lines +133 to +137
let path = Path::new(name);
if metadata(path)?.is_dir() {
return Err(io::Error::new(io::ErrorKind::Other, "Is a directory"));
}
let f = File::open(path)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the path variable necessary? Unless I'm missing something I think you can pass name directly to metadata and File::open.

Comment on lines +306 to +307
at.mkdir("dir");

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A detail:

Suggested change
at.mkdir("dir");
at.mkdir("dir");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants