mirror of
https://gitlab.redox-os.org/CoffeeCode/redox-ssh.git
synced 2025-12-28 15:02:18 +01:00
Remove forking for now (no libc on rust stable)
This commit is contained in:
parent
39d3e76a11
commit
6380617655
1 changed files with 0 additions and 20 deletions
|
|
@ -1,5 +1,3 @@
|
|||
#![cfg_attr(not(target_os = "redox"), feature(libc))]
|
||||
|
||||
extern crate ssh;
|
||||
|
||||
use std::io::{self, Write};
|
||||
|
|
@ -9,7 +7,6 @@ use std::process;
|
|||
use ssh::{Server, ServerConfig};
|
||||
|
||||
pub fn main() {
|
||||
let mut foreground = false;
|
||||
let mut quiet = false;
|
||||
|
||||
let mut config = ServerConfig::default();
|
||||
|
|
@ -17,7 +14,6 @@ pub fn main() {
|
|||
let mut args = env::args().skip(1);
|
||||
while let Some(arg) = args.next() {
|
||||
match arg.as_ref() {
|
||||
"-f" => foreground = true,
|
||||
"-q" => quiet = true,
|
||||
"-p" => {
|
||||
config.port = u16::from_str(&args.next().expect("sshd: no argument to -p option"))
|
||||
|
|
@ -29,24 +25,8 @@ pub fn main() {
|
|||
|
||||
let server = Server::with_config(config);
|
||||
|
||||
if !foreground && fork() != 0 {
|
||||
process::exit(0);
|
||||
}
|
||||
|
||||
if let Err(err) = server.run() {
|
||||
writeln!(io::stderr(), "sshd: {}", err).unwrap();
|
||||
process::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "redox")]
|
||||
fn fork() -> usize {
|
||||
extern crate syscall;
|
||||
unsafe { syscall::clone(0).unwrap() }
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "redox"))]
|
||||
fn fork() -> usize {
|
||||
extern crate libc;
|
||||
unsafe { libc::fork() as usize }
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue