Fix close in ptyd
This commit is contained in:
parent
5a63699325
commit
dd63693c4a
|
@ -1 +1 @@
|
|||
Subproject commit 6f44e698efdaaf308aa9f50892d8ca0a72d210aa
|
||||
Subproject commit 3ad66c8a8e2dc11dbc50995b0e7cbf05391347e4
|
|
@ -1 +1 @@
|
|||
Subproject commit daa786a4ea5b932296bff47ecdf81b4c3b715454
|
||||
Subproject commit 2c366e9bca7ca97096a77c7c3e355eeacb6db963
|
|
@ -53,6 +53,7 @@ impl SchemeMut for PtyScheme {
|
|||
}
|
||||
|
||||
fn dup(&mut self, id: usize, _buf: &[u8]) -> Result<usize> {
|
||||
/* TODO CLOEXEC - Master cannot be cloned
|
||||
let master_opt = self.ptys.0.get(&id).map(|pipe| pipe.clone());
|
||||
if let Some(pipe) = master_opt {
|
||||
let pipe_id = self.next_id;
|
||||
|
@ -60,6 +61,7 @@ impl SchemeMut for PtyScheme {
|
|||
self.ptys.0.insert(pipe_id, pipe);
|
||||
return Ok(pipe_id);
|
||||
}
|
||||
*/
|
||||
|
||||
let slave_opt = self.ptys.1.get(&id).map(|pipe| pipe.clone());
|
||||
if let Some(pipe) = slave_opt {
|
||||
|
@ -330,6 +332,17 @@ fn main(){
|
|||
c: syscall::flag::EVENT_READ,
|
||||
d: data.len()
|
||||
}).expect("pty: failed to write event");
|
||||
} else if Rc::weak_count(&master.read) == 0 {
|
||||
socket.write(&Packet {
|
||||
id: 0,
|
||||
pid: 0,
|
||||
uid: 0,
|
||||
gid: 0,
|
||||
a: syscall::number::SYS_FEVENT,
|
||||
b: *id,
|
||||
c: syscall::flag::EVENT_READ,
|
||||
d: 0
|
||||
}).expect("pty: failed to write event");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue