]> git.lizzy.rs Git - rust.git/commit
std: clear errno before readdir, then check it (solaris)
authorJosh Stone <cuviper@gmail.com>
Tue, 12 Jul 2016 04:43:53 +0000 (21:43 -0700)
committerJosh Stone <cuviper@gmail.com>
Tue, 12 Jul 2016 04:43:53 +0000 (21:43 -0700)
commit79fb5522bd5bf79c7dad7adfd516ad364dff3e9e
treed130a67fc71d00d8d6b0bb39755556727fb00a8c
parent726fa9f09f467cd445758ac8b1bbe8a786aadc9b
std: clear errno before readdir, then check it (solaris)

A `NULL` from `readdir` could be the end of stream or an error.  The
only way to know is to check `errno`, so it must be set to a known value
first, like a 0 that POSIX will never use.

This patch adds `set_errno`, uses it to clear the value before calling
`readdir`, then checks it again after to see the reason for a `NULL`.
src/libstd/sys/unix/fs.rs
src/libstd/sys/unix/os.rs