mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-22 01:49:11 +00:00
revoke_pty: use killpg() not kill() to send HUP to the process group
Also make sure we never call killpg(-1, SIGHUP), which would send SIGHUP to process 1 (init). It is possible for cmnd_pid to be -1 in certain error conditions where sudo killed the command itself. This may explain GitHub issue #458.
This commit is contained in:
parent
e5d953f339
commit
fb208d383a
@ -358,9 +358,11 @@ revoke_pty(struct exec_closure *ec)
|
|||||||
pgrp = tcpgrp;
|
pgrp = tcpgrp;
|
||||||
close(io_fds[SFD_LEADER]);
|
close(io_fds[SFD_LEADER]);
|
||||||
}
|
}
|
||||||
sudo_debug_printf(SUDO_DEBUG_NOTICE, "%s: killpg(%d, SIGHUP)",
|
if (pgrp != -1) {
|
||||||
__func__, (int)pgrp);
|
sudo_debug_printf(SUDO_DEBUG_NOTICE, "%s: killpg(%d, SIGHUP)",
|
||||||
kill(pgrp, SIGHUP);
|
__func__, (int)pgrp);
|
||||||
|
killpg(pgrp, SIGHUP);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user