diff options
| author | Geoffrey Thomas <geofft@ldpreload.com> | 2015-06-19 21:11:10 -0400 |
|---|---|---|
| committer | Geoffrey Thomas <geofft@ldpreload.com> | 2015-06-19 23:34:37 -0400 |
| commit | 058a0f0b0bb1c39d620f7ce1d81150141c6a6341 (patch) | |
| tree | 450444c2ef09f82c2aee249c9377e0260b1c3f7e /src/libstd/sys/unix/stack_overflow.rs | |
| parent | a9515698fa456390386087ccb6123ce741f18527 (diff) | |
| download | rust-058a0f0b0bb1c39d620f7ce1d81150141c6a6341.tar.gz rust-058a0f0b0bb1c39d620f7ce1d81150141c6a6341.zip | |
liblibc: Fix prototype of functions taking `char *const argv[]`
The execv family of functions do not modify their arguments, so they do not need mutable pointers. The C prototypes take a constant array of mutable C-strings, but that's a legacy quirk from before C had const (since C string literals have type `char *`). The Rust prototypes had `*mut` in the wrong place, anyway: to match the C prototypes, it should have been `*const *mut c_char`. But it is safe to pass constant strings (like string literals) to these functions. getopt is a special case, since GNU getopt modifies its arguments despite the `const` claim in the prototype. It is apparently only well-defined to call getopt on the actual argc and argv parameters passed to main, anyway. Change it to take `*mut *mut c_char` for an attempt at safety, but probably nobody should be using it from Rust, since there's no great way to get at the parameters as passed to main. Also fix the one caller of execvp in libstd, which now no longer needs an unsafe cast. Fixes #16290.
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions
