terminal: reaper callback: don’t close ptmx if already closed

This commit is contained in:
Daniel Eklöf 2020-12-26 01:35:17 +01:00
parent 8b0ef6aa85
commit 0dbd85ed9e
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -957,8 +957,11 @@ slave_died(struct reaper *reaper, pid_t pid, void *data)
LOG_DBG("slave (PID=%u) died", pid);
if (term->conf->hold_at_exit) {
fdm_del(term->fdm, term->ptmx);
term->ptmx = -1;
/* The PTMX FDM handler may already have closed our end */
if (term->ptmx >= 0) {
fdm_del(term->fdm, term->ptmx);
term->ptmx = -1;
}
return true;
}