Skip to content

Commit b877b77

Browse files
committed
std::os::errno returns platform specific value. fixes #21898
1 parent ac134f7 commit b877b77

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/libstd/old_io/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ impl IoError {
337337
/// If `detail` is `true`, the `detail` field of the `IoError`
338338
/// struct is filled with an allocated string describing the error
339339
/// in more detail, retrieved from the operating system.
340-
pub fn from_errno(errno: uint, detail: bool) -> IoError {
340+
pub fn from_errno(errno: i32, detail: bool) -> IoError {
341341
let mut err = sys::decode_error(errno as i32);
342342
if detail && err.kind == OtherIoError {
343343
err.detail = Some(os::error_string(errno).chars()
@@ -353,7 +353,7 @@ impl IoError {
353353
/// operating system) between the call(s) for which errors are
354354
/// being checked and the call of this function.
355355
pub fn last_error() -> IoError {
356-
IoError::from_errno(os::errno() as uint, true)
356+
IoError::from_errno(os::errno() as i32, true)
357357
}
358358
}
359359

src/libstd/os.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,8 @@ pub fn change_dir(p: &Path) -> IoResult<()> {
513513
}
514514

515515
/// Returns the platform-specific value of errno
516-
pub fn errno() -> uint {
517-
sys::os::errno() as uint
516+
pub fn errno() -> i32 {
517+
sys::os::errno() as i32
518518
}
519519

520520
/// Return the string corresponding to an `errno()` value of `errnum`.
@@ -524,15 +524,15 @@ pub fn errno() -> uint {
524524
/// use std::os;
525525
///
526526
/// // Same as println!("{}", last_os_error());
527-
/// println!("{}", os::error_string(os::errno() as uint));
527+
/// println!("{}", os::error_string(os::errno() as i32));
528528
/// ```
529-
pub fn error_string(errnum: uint) -> String {
529+
pub fn error_string(errnum: i32) -> String {
530530
return sys::os::error_string(errnum as i32);
531531
}
532532

533533
/// Get a string representing the platform-dependent last error
534534
pub fn last_os_error() -> String {
535-
error_string(errno() as uint)
535+
error_string(errno() as i32)
536536
}
537537

538538
/// Sets the process exit code

src/libstd/sys/unix/process.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ impl Process {
388388
match unsafe { c::select(max, &mut set, ptr::null_mut(),
389389
ptr::null_mut(), p) } {
390390
// interrupted, retry
391-
-1 if os::errno() == libc::EINTR as uint => continue,
391+
-1 if os::errno() == libc::EINTR as i32 => continue,
392392

393393
// We read something, break out and process
394394
1 | 2 => {}

src/libstd/sys/unix/timer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ fn helper(input: libc::c_int, messages: Receiver<Req>, _: ()) {
198198
assert_eq!(fd.read(&mut buf).ok().unwrap(), 1);
199199
}
200200

201-
-1 if os::errno() == libc::EINTR as uint => {}
201+
-1 if os::errno() == libc::EINTR as i32 => {}
202202
n => panic!("helper thread failed in select() with error: {} ({})",
203203
n, os::last_os_error())
204204
}

0 commit comments

Comments
 (0)