Commit 63806176 authored by Thomas Gatzweiler's avatar Thomas Gatzweiler
Browse files

Remove forking for now (no libc on rust stable)

parent 39d3e76a
#![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 }
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment