chiark / gitweb /
nix: Make a compat function for last errno as Errno
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 25 Feb 2024 17:18:21 +0000 (17:18 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 25 Feb 2024 18:15:20 +0000 (18:15 +0000)
This fixes a warning.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
server/daemon.rs
src/compat.rs

index 48b664a6f31ea1b87c8272f16faf7234e489c5fd..944d8dcca8c526cef08c22f2ae280bf743a1a2dc 100644 (file)
@@ -120,7 +120,7 @@ unsafe fn intermediate(child: Pid, st_wfd: RawFd) -> ! {
 
   let r = libc::waitpid(child.as_raw(), &mut wstatus, 0);
   if r == -1 { crashe("await child startup status",
-                      nix::errno::from_i32(errno())) }
+                      compat::nix_last_errno()) }
   if r != child.as_raw() { crashm("await child startup status: wrong pid") }
 
   let cooked = WaitStatus::from_raw(child, wstatus)
index 220ab11be7250aa1494a88223e2d28c2acd24913..dff38bf622e1105e5537c57e8d03c08a8f02514c 100644 (file)
@@ -53,3 +53,9 @@ pub fn pipe() -> nix::Result<(c_int, c_int)> {
   }};
   Ok((map(a), map(b)))
 }
+
+#[allow(deprecated)]
+pub fn nix_last_errno() -> nix::errno::Errno {
+  use nix::errno::*;
+  from_i32(errno())
+}