diff options
| author | Nikita Baksalyar <nikita.baksalyar@gmail.com> | 2016-01-26 17:15:10 +0300 |
|---|---|---|
| committer | Nikita Baksalyar <nikita.baksalyar@gmail.com> | 2016-01-31 18:57:28 +0300 |
| commit | ebab24059a2b85cf6167c589c40a265f815d9f45 (patch) | |
| tree | 45743743244ea0ac23f8bbc9518265d7adce155a /src/libstd/sys/unix/os.rs | |
| parent | f189d7a6937c063f9592136a39c836b17c008a93 (diff) | |
| download | rust-ebab24059a2b85cf6167c589c40a265f815d9f45.tar.gz rust-ebab24059a2b85cf6167c589c40a265f815d9f45.zip | |
Apply several fixes for Illumos support
Diffstat (limited to 'src/libstd/sys/unix/os.rs')
| -rw-r--r-- | src/libstd/sys/unix/os.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index e77cd65edde..e6883a11ada 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -269,12 +269,14 @@ pub fn current_exe() -> io::Result<PathBuf> { Err(io::Error::last_os_error()) } else { let filename = CStr::from_ptr(path).to_bytes(); + let path = PathBuf::from(<OsStr as OsStrExt>::from_bytes(filename)); + + // Prepend a current working directory to the path if + // it doesn't contain an absolute pathname. if filename[0] == b'/' { - Ok(PathBuf::from(<OsStr as OsStrExt>::from_bytes(filename))) + Ok(path) } else { - // Prepend current working directory to the path if - // it doesn't contain an absolute pathname. - return getcwd().map(|cwd| cwd.join(<OsStr as OsStrExt>::from_bytes(filename))) + getcwd().map(|cwd| cwd.join(path)) } } } |
