Lines 87-92
Link Here
|
87 |
InvalidTag, |
87 |
InvalidTag, |
88 |
} |
88 |
} |
89 |
|
89 |
|
|
|
90 |
extern "C" { |
91 |
fn dup(input: i32) -> i32; |
92 |
} |
93 |
|
90 |
impl fmt::Display for Error { |
94 |
impl fmt::Display for Error { |
91 |
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
95 |
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
92 |
use self::Error::UnshareCloneFs; |
96 |
use self::Error::UnshareCloneFs; |
Lines 1042-1048
Link Here
|
1042 |
// We need to keep _pid_file around because it maintains a lock on the pid file |
1046 |
// We need to keep _pid_file around because it maintains a lock on the pid file |
1043 |
// that prevents another daemon from using the same pid file. |
1047 |
// that prevents another daemon from using the same pid file. |
1044 |
let (listener, socket_path, _pid_file) = match opt.fd.as_ref() { |
1048 |
let (listener, socket_path, _pid_file) = match opt.fd.as_ref() { |
1045 |
Some(fd) => unsafe { (Listener::from_raw_fd(*fd), None, None) }, |
1049 |
Some(fd) => unsafe { (Listener::from_raw_fd(dup(*fd)), None, None) }, |
1046 |
None => { |
1050 |
None => { |
1047 |
// Set umask to ensure the socket is created with the right permissions |
1051 |
// Set umask to ensure the socket is created with the right permissions |
1048 |
let _umask_guard = oslib::ScopedUmask::new(umask); |
1052 |
let _umask_guard = oslib::ScopedUmask::new(umask); |
Lines 1173-1181
Link Here
|
1173 |
|
1177 |
|
1174 |
info!("Waiting for vhost-user socket connection..."); |
1178 |
info!("Waiting for vhost-user socket connection..."); |
1175 |
|
1179 |
|
1176 |
if let Err(e) = daemon.start(listener) { |
1180 |
match opt.fd.as_ref() { |
1177 |
error!("Failed to start daemon: {:?}", e); |
1181 |
Some(fd) => { |
1178 |
process::exit(1); |
1182 |
if let Err(e) = daemon.start_from_rawfd(listener, *fd) { |
|
|
1183 |
error!("Failed to start daemon: {:?}", e); |
1184 |
process::exit(1); |
1185 |
} |
1186 |
} |
1187 |
None => { |
1188 |
if let Err(e) = daemon.start(listener) { |
1189 |
error!("Failed to start daemon: {:?}", e); |
1190 |
process::exit(1); |
1191 |
} |
1192 |
} |
1179 |
} |
1193 |
} |
1180 |
|
1194 |
|
1181 |
info!("Client connected, servicing requests"); |
1195 |
info!("Client connected, servicing requests"); |