fix most compiler warnings
This commit is contained in:
+7
-8
@@ -30,7 +30,6 @@ use libc::{
|
||||
|
||||
// wait,
|
||||
c_int,
|
||||
c_uint,
|
||||
|
||||
WIFEXITED,
|
||||
WIFSIGNALED,
|
||||
@@ -41,7 +40,7 @@ use libc::{
|
||||
|
||||
enum WaitStatus {
|
||||
Exited(pid_t, c_int),
|
||||
Signaled(pid_t, c_int, bool),
|
||||
Signaled(pid_t, c_int),
|
||||
}
|
||||
use crate::WaitStatus::*;
|
||||
|
||||
@@ -69,7 +68,7 @@ fn wait() -> Result<WaitStatus, std::io::Error> {
|
||||
if WIFEXITED(wstatus) {
|
||||
return Ok(WaitStatus::Exited(pid, WEXITSTATUS(wstatus)))
|
||||
} else if WIFSIGNALED(wstatus) {
|
||||
return Ok(WaitStatus::Signaled(pid, WTERMSIG(wstatus), false))
|
||||
return Ok(WaitStatus::Signaled(pid, WTERMSIG(wstatus)))
|
||||
}
|
||||
}
|
||||
Err(std::io::Error::last_os_error())
|
||||
@@ -101,9 +100,9 @@ fn fork_lua(lua : &Lua, args: Vec<String>, fds: Vec<i32>) -> Option<i32> {
|
||||
let globals = lua.globals();
|
||||
if let Ok(arg_table) = lua.create_table() {
|
||||
for (i, arg) in args.iter().enumerate() {
|
||||
arg_table.set(i, arg.clone());
|
||||
arg_table.set(i, arg.clone()).expect("arg set failed");
|
||||
}
|
||||
globals.set("arg".to_string(), arg_table);
|
||||
globals.set("arg".to_string(), arg_table).expect("arg set failed");
|
||||
}
|
||||
|
||||
let chunk = lua.load(path);
|
||||
@@ -157,7 +156,7 @@ fn main() -> std::io::Result<()> {
|
||||
|
||||
unsafe {
|
||||
sigchild_fd = sigchild_writer.as_raw_fd();
|
||||
libc::signal(libc::SIGCHLD, handle_sigchld as libc::sighandler_t);
|
||||
libc::signal(libc::SIGCHLD, handle_sigchld as *const () as libc::sighandler_t);
|
||||
};
|
||||
let lua = unsafe { Lua::unsafe_new() };
|
||||
|
||||
@@ -223,10 +222,10 @@ fn main() -> std::io::Result<()> {
|
||||
if let Some((pid, ret)) =
|
||||
match wstatus {
|
||||
Exited(pid, code) => Some((pid, code as u32)),
|
||||
Signaled(pid, sig, _) => Some((pid, (sig as u32) + 128))
|
||||
Signaled(pid, sig) => Some((pid, (sig as u32) + 128))
|
||||
} {
|
||||
if let Some(addr) = peers.get(&pid) {
|
||||
sock.send_to_addr(&ret.to_be_bytes(), addr);
|
||||
let _ = sock.send_to_addr(&ret.to_be_bytes(), addr);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user