about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorJormundir <Chaseph@gmail.com>2015-02-03 22:01:24 -0800
committerJormundir <Chaseph@gmail.com>2015-02-04 07:34:01 -0800
commitb877b77f1363c6e8bb8b9cc11c600ecb17a2fcc9 (patch)
treef5dbc302e0f9f051fd3f3a979f47a943fc11b403 /src/libstd
parentac134f7ca435551964996ee88319241cd3c7c110 (diff)
downloadrust-b877b77f1363c6e8bb8b9cc11c600ecb17a2fcc9.tar.gz
rust-b877b77f1363c6e8bb8b9cc11c600ecb17a2fcc9.zip
std::os::errno returns platform specific value. fixes #21898
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/old_io/mod.rs4
-rw-r--r--src/libstd/os.rs10
-rw-r--r--src/libstd/sys/unix/process.rs2
-rw-r--r--src/libstd/sys/unix/timer.rs2
4 files changed, 9 insertions, 9 deletions
diff --git a/src/libstd/old_io/mod.rs b/src/libstd/old_io/mod.rs
index c9cabe648b9..8818211010f 100644
--- a/src/libstd/old_io/mod.rs
+++ b/src/libstd/old_io/mod.rs
@@ -337,7 +337,7 @@ impl IoError {
     /// If `detail` is `true`, the `detail` field of the `IoError`
     /// struct is filled with an allocated string describing the error
     /// in more detail, retrieved from the operating system.
-    pub fn from_errno(errno: uint, detail: bool) -> IoError {
+    pub fn from_errno(errno: i32, detail: bool) -> IoError {
         let mut err = sys::decode_error(errno as i32);
         if detail && err.kind == OtherIoError {
             err.detail = Some(os::error_string(errno).chars()
@@ -353,7 +353,7 @@ impl IoError {
     /// operating system) between the call(s) for which errors are
     /// being checked and the call of this function.
     pub fn last_error() -> IoError {
-        IoError::from_errno(os::errno() as uint, true)
+        IoError::from_errno(os::errno() as i32, true)
     }
 }
 
diff --git a/src/libstd/os.rs b/src/libstd/os.rs
index 64f9e16aee4..8d1c3a1e3ae 100644
--- a/src/libstd/os.rs
+++ b/src/libstd/os.rs
@@ -513,8 +513,8 @@ pub fn change_dir(p: &Path) -> IoResult<()> {
 }
 
 /// Returns the platform-specific value of errno
-pub fn errno() -> uint {
-    sys::os::errno() as uint
+pub fn errno() -> i32 {
+    sys::os::errno() as i32
 }
 
 /// Return the string corresponding to an `errno()` value of `errnum`.
@@ -524,15 +524,15 @@ pub fn errno() -> uint {
 /// use std::os;
 ///
 /// // Same as println!("{}", last_os_error());
-/// println!("{}", os::error_string(os::errno() as uint));
+/// println!("{}", os::error_string(os::errno() as i32));
 /// ```
-pub fn error_string(errnum: uint) -> String {
+pub fn error_string(errnum: i32) -> String {
     return sys::os::error_string(errnum as i32);
 }
 
 /// Get a string representing the platform-dependent last error
 pub fn last_os_error() -> String {
-    error_string(errno() as uint)
+    error_string(errno() as i32)
 }
 
 /// Sets the process exit code
diff --git a/src/libstd/sys/unix/process.rs b/src/libstd/sys/unix/process.rs
index 20f86227e8e..87bf848144d 100644
--- a/src/libstd/sys/unix/process.rs
+++ b/src/libstd/sys/unix/process.rs
@@ -388,7 +388,7 @@ impl Process {
                 match unsafe { c::select(max, &mut set, ptr::null_mut(),
                                          ptr::null_mut(), p) } {
                     // interrupted, retry
-                    -1 if os::errno() == libc::EINTR as uint => continue,
+                    -1 if os::errno() == libc::EINTR as i32 => continue,
 
                     // We read something, break out and process
                     1 | 2 => {}
diff --git a/src/libstd/sys/unix/timer.rs b/src/libstd/sys/unix/timer.rs
index 6a4e47f58ce..4cd98f4442b 100644
--- a/src/libstd/sys/unix/timer.rs
+++ b/src/libstd/sys/unix/timer.rs
@@ -198,7 +198,7 @@ fn helper(input: libc::c_int, messages: Receiver<Req>, _: ()) {
                 assert_eq!(fd.read(&mut buf).ok().unwrap(), 1);
             }
 
-            -1 if os::errno() == libc::EINTR as uint => {}
+            -1 if os::errno() == libc::EINTR as i32 => {}
             n => panic!("helper thread failed in select() with error: {} ({})",
                        n, os::last_os_error())
         }