]> git.lizzy.rs Git - rust.git/commitdiff
auto merge of #19303 : nodakai/rust/libsyntax-reject-dirs, r=alexcrichton
authorbors <bors@rust-lang.org>
Fri, 5 Dec 2014 00:22:58 +0000 (00:22 +0000)
committerbors <bors@rust-lang.org>
Fri, 5 Dec 2014 00:22:58 +0000 (00:22 +0000)
On *BSD systems, we can `open(2)` a directory and directly `read(2)` from it due to an old tradition.  We should avoid doing so by explicitly calling `fstat(2)` to check the type of the opened file.

Opening a directory as a module file can't always be avoided.  Even when there's no "path" attribute trick involved, there can always be a *directory* named `my_module.rs`.

Incidentally, remove unnecessary mutability of `&self` from `io::fs::File::stat()`.

1  2 
src/libstd/io/fs.rs

Simple merge