Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8a2e67e
Simplify chdir implementation and minimize unsafe block
joshtriplett Apr 29, 2021
4a63e1e
Allow using `core::` in intra-doc links within core itself
jyn514 Apr 30, 2021
fe68b1a
Fix linker_args with --target=sparcv9-sun-solaris
iladin Apr 30, 2021
0b0d293
Report coverage `0` of dead blocks
richkadel May 1, 2021
3fca198
Move coverage tests from run-make-fulldeps to run-make
richkadel May 1, 2021
1e89b58
Account for unsatisfied bounds in E0599
estebank May 2, 2021
367c1db
:arrow_up: rust-analyzer
lnicola May 3, 2021
2e559c8
use `else if` in std library
wcampbell0x2a May 3, 2021
b4bfb0e
Update RELEASES.md for 1.52.0
XAMPPRocky Apr 14, 2021
6eb4735
Unify rustc and rustdoc parsing of `cfg()`
jyn514 Apr 22, 2021
389333a
Update `ptr` docs with regards to `ptr::addr_of!`
jfrimmel Mar 27, 2021
71b5ccb
Implement RFC 2951: Native link modifiers
luqmana Mar 25, 2021
2d9234e
Rollup merge of #83507 - luqmana:native-link-modifiers, r=petrochenkov
Dylan-DPC May 5, 2021
45ec84d
Rollup merge of #83553 - jfrimmel:addr-of, r=m-ou-se
Dylan-DPC May 5, 2021
c01cdcf
Rollup merge of #84183 - rust-lang:relnotes-1.52.0, r=pietroalbini
Dylan-DPC May 5, 2021
4a32f99
Rollup merge of #84442 - jyn514:doc-cfg, r=petrochenkov
Dylan-DPC May 5, 2021
da482cc
Rollup merge of #84468 - iladin:iladin/fix-84467, r=petrochenkov
Dylan-DPC May 5, 2021
ab9c15e
Rollup merge of #84712 - joshtriplett:simplify-chdir, r=yaahc
Dylan-DPC May 5, 2021
a8136c2
Rollup merge of #84755 - jyn514:core-links, r=kennytm
Dylan-DPC May 5, 2021
7d26d3b
Rollup merge of #84797 - richkadel:cover-unreachable-statements, r=tm…
Dylan-DPC May 5, 2021
bdc7168
Rollup merge of #84808 - estebank:issue-84769, r=petrochenkov
Dylan-DPC May 5, 2021
47257dd
Rollup merge of #84843 - wcampbell0x2a:use-else-if-let, r=dtolnay
Dylan-DPC May 5, 2021
427aa73
Rollup merge of #84851 - lnicola:rust-analyzer-2021-05-03, r=jonas-sc…
Dylan-DPC May 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Simplify chdir implementation and minimize unsafe block
  • Loading branch information
joshtriplett committed Apr 29, 2021
commit 8a2e67e0d0826f73531f79ecc8d14aba71a8d837
8 changes: 3 additions & 5 deletions library/std/src/sys/unix/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,10 @@ pub fn getcwd() -> io::Result<PathBuf> {
pub fn chdir(p: &path::Path) -> io::Result<()> {
let p: &OsStr = p.as_ref();
let p = CString::new(p.as_bytes())?;
unsafe {
match libc::chdir(p.as_ptr()) == (0 as c_int) {
true => Ok(()),
false => Err(io::Error::last_os_error()),
}
if unsafe { libc::chdir(p.as_ptr()) } != 0 {
return Err(io::Error::last_os_error());
}
Ok(())
}

pub struct SplitPaths<'a> {
Expand Down