Commit 935bd76
authored
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?5 files changed
+41
-23
lines changed- .travis.yml+73-31
- Cargo.toml+1-1
- ci/cargo-config-13
- ci/docker/aarch64-unknown-linux-gnu/Dockerfile+7
- ci/docker/arm-linux-androideabi/Dockerfile+4
- ci/docker/arm-unknown-linux-gnueabihf/Dockerfile+7
- ci/docker/i686-unknown-linux-gnu/Dockerfile+5
- ci/docker/mips-unknown-linux-gnu/Dockerfile+13
- ci/docker/x86_64-rumprun-netbsd/Dockerfile+6
- ci/docker/x86_64-unknown-freebsd/Dockerfile+13
- ci/docker/x86_64-unknown-linux-gnu/Dockerfile+5
- ci/docker/x86_64-unknown-linux-musl/Dockerfile+13
- ci/docker/x86_64-unknown-openbsd/Dockerfile+7
- ci/mips/Dockerfile-12
- ci/rumprun/Dockerfile-12
- ci/run-all.sh-48
- ci/run-docker.sh+25
- ci/run-qemu.sh+1-4
- ci/run-travis.sh-188
- ci/run.sh+89-7
- libc-test/Cargo.lock+2-2
- libc-test/build.rs+7
- src/lib.rs+1
- src/unix/bsd/apple/mod.rs+38-1
- src/unix/bsd/freebsdlike/mod.rs+53
- src/unix/bsd/mod.rs+7-6
- src/unix/bsd/openbsdlike/mod.rs+49
- src/unix/mod.rs+23
- src/unix/notbsd/android/mod.rs+15
- src/unix/notbsd/linux/mips.rs+9
- src/unix/notbsd/linux/mod.rs+14-4
- src/unix/notbsd/linux/musl/b32/mod.rs+4
- src/unix/notbsd/linux/musl/b64/mod.rs+4
- src/unix/notbsd/linux/other/mod.rs+13
- src/unix/notbsd/mod.rs+60-4
- src/unix/solaris/mod.rs+96-1
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | | - | |
| 33 | + | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
36 | | - | |
| 38 | + | |
| 39 | + | |
37 | 40 | | |
38 | 41 | | |
39 | 42 | | |
40 | | - | |
| 43 | + | |
| 44 | + | |
41 | 45 | | |
42 | 46 | | |
43 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
| 208 | + | |
208 | 209 | | |
209 | 210 | | |
210 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
211 | 217 | | |
212 | 218 | | |
213 | 219 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
38 | 56 | | |
39 | 57 | | |
40 | 58 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
| 59 | + | |
| 60 | + | |
56 | 61 | | |
| 62 | + | |
57 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
58 | 67 | | |
59 | | - | |
| 68 | + | |
60 | 69 | | |
61 | 70 | | |
62 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
| |||
0 commit comments