Check for socket type in filetype.

The signature for Windows has also been changed, so that the function
can be reused in cross-platform modules.
This commit is contained in:
Marcin Mielniczuk
2019-08-26 14:01:59 +02:00
committed by Jakub Konka
parent 8db57bd6c6
commit d617fe67ad
2 changed files with 20 additions and 14 deletions

View File

@@ -288,11 +288,11 @@ pub(crate) fn fd_filestat_get_impl(file: &std::fs::File) -> Result<host::__wasi_
.modified()
.map_err(errno_from_ioerror)
.and_then(systemtime_to_timestamp)?,
st_filetype: filetype(&metadata).map_err(errno_from_ioerror)?,
st_filetype: filetype(&metadata)?,
})
}
fn filetype(metadata: &Metadata) -> io::Result<host::__wasi_filetype_t> {
fn filetype(_file: &File, metadata: &Metadata) -> Result<host::__wasi_filetype_t> {
let ftype = metadata.file_type();
let ret = if ftype.is_file() {
host::__WASI_FILETYPE_REGULAR_FILE