diff options
| author | bors <bors@rust-lang.org> | 2016-07-13 19:32:17 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-07-13 19:32:17 -0700 |
| commit | 935bd763674ea3e5b79928bed08016291cc52901 (patch) | |
| tree | be4885c9792ca6abe3f8a12b7a33533b0d9980d9 /src/libstd/sys/common | |
| parent | 3dbbe2f716a09246939ad371125617c5526fd3fd (diff) | |
| parent | 79fb5522bd5bf79c7dad7adfd516ad364dff3e9e (diff) | |
| download | rust-935bd763674ea3e5b79928bed08016291cc52901.tar.gz rust-935bd763674ea3e5b79928bed08016291cc52901.zip | |
Auto merge of #34776 - cuviper:solaris-readdir, r=alexcrichton
std: fix `readdir` errors for 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 currently only matters for solaris targets, as the other unix platforms are using `readdir_r` with a direct error return indication. However, this is getting deprecated (#34668) so they should all eventually switch to `readdir`. This PR adds `set_errno`, uses it to clear the value before calling `readdir`, then checks it again after to see the reason for a `NULL`. A few other small fixes are included just to get solaris compiling at all. I couldn't get cross-compilation completely going, so I don't have a good way to test this beyond a smoke-test cargo build of std. I'd appreciate input from someone more familiar with solaris -- cc @nbaksalyar?
Diffstat (limited to 'src/libstd/sys/common')
| -rw-r--r-- | src/libstd/sys/common/net.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libstd/sys/common/net.rs b/src/libstd/sys/common/net.rs index 8b7af17f92b..442618c55b3 100644 --- a/src/libstd/sys/common/net.rs +++ b/src/libstd/sys/common/net.rs @@ -25,19 +25,23 @@ use time::Duration; #[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "ios", target_os = "macos", - target_os = "openbsd", target_os = "netbsd"))] + target_os = "openbsd", target_os = "netbsd", + target_os = "solaris"))] use sys::net::netc::IPV6_JOIN_GROUP as IPV6_ADD_MEMBERSHIP; #[cfg(not(any(target_os = "dragonfly", target_os = "freebsd", target_os = "ios", target_os = "macos", - target_os = "openbsd", target_os = "netbsd")))] + target_os = "openbsd", target_os = "netbsd", + target_os = "solaris")))] use sys::net::netc::IPV6_ADD_MEMBERSHIP; #[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "ios", target_os = "macos", - target_os = "openbsd", target_os = "netbsd"))] + target_os = "openbsd", target_os = "netbsd", + target_os = "solaris"))] use sys::net::netc::IPV6_LEAVE_GROUP as IPV6_DROP_MEMBERSHIP; #[cfg(not(any(target_os = "dragonfly", target_os = "freebsd", target_os = "ios", target_os = "macos", - target_os = "openbsd", target_os = "netbsd")))] + target_os = "openbsd", target_os = "netbsd", + target_os = "solaris")))] use sys::net::netc::IPV6_DROP_MEMBERSHIP; //////////////////////////////////////////////////////////////////////////////// |
